create Tag

I just read the article by Pratik Naik from the Rails Core Team regarding Rails Templates.

Have you ever wished you could start out your Rails application with all of your gems installed and all of your standard setup items completed? Well, wait no longer. You can now do it with Rails Templates. Pratik covered it pretty well, so I’m not going to repeat what he’s done. Rather, I’m going to share a template of my own and explain why I included what I did.

Read More

  • DZone
  • Twitter
  • Slashdot
  • Delicious
  • Digg
  • Technorati Favorites
  • Facebook
  • Reddit
  • StumbleUpon
  • LiveJournal
  • Squidoo
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark

One problem that seems to face people when they’re attempting to move their applications into production is the best way to manage deployment of their application. This is where tools like capistrano comes in.

Capistrano was written by Jamis Buck of 37signals. In a lot of ways it has become the defacto way to deploy Ruby on Rails applications. It has also had tools like webistrano build on top of it to provide a graphical interface to the command line tool.

To get started, you need to install the capistrano gem:

gem install capistrano

Read More

  • DZone
  • Twitter
  • Slashdot
  • Delicious
  • Digg
  • Technorati Favorites
  • Facebook
  • Reddit
  • StumbleUpon
  • LiveJournal
  • Squidoo
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark

Last week, my development team and I ran across a problem with a library we had written several months before that parsed spreadsheets given to us by one of our clients and inserted the data provided into the database. At the time we weren’t sure what the problem was. We decided to run the tests and two frustratingly useless things occurred. First, all of the tests passed. Second, the test suite took 3 hours to run.

Here’s what we had done in our “unit tests.” We had placed several of these spreadsheets as examples into our fixtures folder. Then, we had created the importer object and told it to import. We then checked the results. These tests take a long time, specifically because an import can sometimes take 15 minutes depending on the amount of data we need to import. So, how do you fix something like that? Here are some ideas.

Read More

  • DZone
  • Twitter
  • Slashdot
  • Delicious
  • Digg
  • Technorati Favorites
  • Facebook
  • Reddit
  • StumbleUpon
  • LiveJournal
  • Squidoo
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark

I just started building a new Rails application in version 2.3.4. One feature that I thought was particularly handy is the data seeding that is now built into Ruby on Rails.

Before this feature, you would have to do one of two things. You could seed your data in your migrations. The problem with this approach is that it clutters up your migrations, and can make for more brittle migrations. It also may or may not propagate to your test database when you run your tests, meaning that if you’re counting on it, it may not bee there.

Your second option was to create fixtures and a rake task to import the fixture data into your Rails application. The problem with this is the need to create multiple related objects across multiple files to make all of your data match up, which can create maintenance problems.

So, without further ado, here is the solution now included in Rails. You simple create a file at db/seeds.rb and place ActiveRecord create calls in the file. Here’s an example seeds.rb.
Read More

  • DZone
  • Twitter
  • Slashdot
  • Delicious
  • Digg
  • Technorati Favorites
  • Facebook
  • Reddit
  • StumbleUpon
  • LiveJournal
  • Squidoo
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark