Workaround for File Input on Rails Remote Forms

Workaround for File Input on Rails Remote Forms

Recently, I worked on a project which included a form that was being submitted remotely using jQuery-Rails. The main problem was that the form needed to have a file input on it and jQuery-Rails won’t work if you have one. Now, there are workarounds that work if you need to actually keep the file input. In my case, I was processing the file with JavaScript and then just submitting the parsed data, so the file input wasn’t really needed.

Read more

Using Bootstrap Panels to Organize Data in a Rails App

Using Bootstrap Panels to Organize Data in a Rails App

I’m creating a basic pantry application which will be able to catalog current items in the user’s pantry.  So, one of the pages needed will display different food items and the current quantities in the user’s pantry.  A way to organize this data is to use a Bootstrap Panel to display the current totals and when the selected panel is clicked, individual data values will be displayed.

The data structure consists of Store, Producer, and Unit models, which all just consist of a name.  Next, we have the Food model which has a name, upc, servings, serving_size, and references to a Producer and Unit.  Finally, we have the Stock model which has a price, quantity, discount, bought, and references to Food, Store, and User (for the User I’m just using the basic Devise User model).

Read more

Parsing Excel Files in Rails

Parsing Excel Files in Rails

I’m doing a project where I need to import a spreadsheet, parse it, and then insert the data into the database.  Now my first concern for finding a gem was that it could support more than one format of spreadsheet file.  My second concern was that I wanted to be able to easily iterate over sheets, rows, and columns.  My third and last concern was if it’s still being actively developed.  While doing research for reading spreadsheet files I found 2 primary candidates.

The first candidate is the Spreadsheet gem.  This was the first gem I tried and could easily iterate over sheets, rows, and columns.  It was also still being actively developed.  But the primary disadvantage is that it will only work with .xls files.  Here is an example of how to use this spreadsheet gem to iterate over sheets and rows.

Read more

The Power of WordPress Themes and Templates

The Power of WordPress Themes and Templates

WordPress is a popular CMS that is both free and relatively painless to setup.  Since you’ll want to get the most out of this system, we will discuss developing a simple template page.

Depending on the purpose of your site, you might want to develop a WordPress theme of your own. For this example we only need a simple template, so just follow the example of creating a child theme at WordPress.

Read more