Friday, June 21, 2013

Create a New Rails App in a Previous Version of Rails

So, I have Rails 4.0 installed and have been playing around with it, but I wanted to make a new app in the current stable version I have installed, which is 3.2.12. My system was defaulting to 4.0 since I had installed it. I didn't want to uninstall it. You can do this with RVM by creating a new gemset, but as a hobbyist developer, it just seemed convoluted to me.

The easiest way I found to create a new app in a version of Rails previous to 4.0?

  1. Create your new app: 'rails new new_app'. 
  2. Open the Gemfile from a recent project using 3.2.12 
  3. Copy the text of the Gemfile.
  4. cd into your new_app folder. 
  5. Open the new_app Gemfile in your text editor. 
  6. Paste the text you just copied into that Gemfile. This also ensures that the dependencies are there for your previous version of Rails. The dependencies for 4.0 will not work. 
  7. Remove any gems you know you will not be using in new_app that you may have added to the previous app. 
  8. 'bundle install' and you've got yourself a previous version and you've still got 4.0 installed.