Sunday, June 19, 2011

Creating a new application with an older version of Rails

This weekend, I've been working through Agile Web Development with Rails, but I ran into a problem. The book is using Rails version 3.0.5, and I've been updated to Rails 3.1.0.rc2. Some things have been changed from Rails 3.0 to Rails 3.1. Most of these appear to be small, easy to work with changes such as moving images and stylesheets from /public to /assets, but Jquery is the new default javascript library for Rails and this is where I ran into trouble.

First off, I noticed the CSS wasn't working exactly as it did the first time I went through Agile Web Development with Rails. Mostly some minor issues that I was able to work with, and this wasn't that big a deal, since styling is best left until later. But the book deals with some styling up front, so this issue threw a red flag.

Next up, I noticed my :destroy method wasn't working. I ran into this issue a couple weeks ago with Chorenivore, and it was a matter of configuring Jquery. So I tried the fix that worked for me before, but I'm not sure why it wasn't working with a Rails 3.1 app. Is there more configuration needed? I generated the code with a scaffold command, so I'm not sure why it wasn't working by default.

At any rate, whether this is a bug (doubtful, even though this is a beta version of Rails 3.1) or I just didn't configure everything correctly, I decided the best solution for now is to create a new application using the same version used in Agile Web Development with Rails.

So the command for creating a new application with a previous version of Rails is easy enough:

rails _3.0.5_ new depot

In this case, I want to use Rails 3.0.5 and my project is named depot, so that's all there is to it! I think the gemfile may need to be edited as well, but so far I haven't run into any issues.

Rails is a framework that is updated and changed regularly, so I know in the long term I'll want to stay current with new versions. But for now, it's more important for me to keep learning and reinforcing what I already know, so using an older version of Rails is the way to go.

No comments:

Post a Comment