Updating Locomotive with the Latest Rails Version

I was working on chapter 9 from the Agile Web Development with Rails. I noticed that clicking on the “Add to Cart” button did not work. I checked my code a few times and found that the code was fine.

I could not find anything useful using the Google search.

I remembered a quote from one of the Sherlock Holmes adventures, “When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.”

I started going through the potential issues that I could think of:
1. I thought I incorrectly typed the code. I even tried to copy and to paste the code from the book. Problem was still there… :(
2. I checked the logs and thought that the database was not working. I saw the database query worked correctly. I even restarted the MySQL server.
3. I tried using Safari to access the project (I usually use Firefox). I wanted to make sure that I could reproduce the problem with a different browser. The problem was there. “Interesting” was the word that came to mind.
4. I restarted Mongrel and the problem persisted. Hmmm… OK.
5. I restarted my Mac. Silly me… :)
6. Finally, I thought that I might have used an older version of Rails since I created the depot project and Rails defaulted the version to 1.1.6.

I mentioned that I used Locomotive for my Rails development. I opened up the terminal window for my project (Command-t) and run the following command:
gem install rails –source http://gems.rubyonrails.org –include-dependencies

Rails was doing its magic to get me the latest version.

I also made sure that my project is using the right version in the environment.rb:
RAILS_GEM_VERSION = ‘1.2.2′

I tried accessing my project again and (WHOO HOOO) it works!

Leave a Reply