Categories
Coding ruby ruby on rails

Upgrading To Rails 3

Here’s how I upgraded Sitebeagle.net to Rails 3.

1. Go into your site’s Rails directory and install rails_upgrade:

script/plugin install git://github.com/rails/rails_upgrade.git

Run the following commands and follow the instructions:

rake rails:upgrade:check
rake rails:upgrade:backup
rake rails:upgrade:routes
rake rails:upgrade:gems
rake rails:upgrade:configuration

2. Make sure that your version of Ruby 1.9+ has iconv working.

Mine didn’t, so I went through this process:

rvm package install readline
rvm package install iconv
rvm remove 1.9.2
rvm install –trace 1.9.2 -C –with-iconv-dir=$HOME/.rvm/usr

to test:
irb
require ‘iconv’ # should return true

3. Upgrade to Rails 3: gem install rails

4. Start migrating to Rails 3: I branched my site using git and went into my Rails root directory and typed:

rails `pwd`

Use your best judgment on what can and cannot be over-written. Here’s my list:

* let rails overwrite?
* overwrite rake file
* overwrite application_controller.rb? yes but copy
* application_helper.rb ? yes
* routes.rb ? yes but copy
* environment.rb ?
* make new initializer for contants
* config.gem? copy and put into a Gemfile
* application.js ? only if confident in js
* scripts? overwrite all

5. See if stuff works:

rails server

Twitter-auth broke for me, so I had to update it to work on Rails 3 using this guide:

https://github.com/benders/twitter-auth/compare/master…rails_3

How’s your upgrade to Rails 3 go? Let me know in the comments below.

Update (14 January 2011):

Chris Laco wrote up this great guide to upgrading Rails 3 on Dreamhost. It solves path problem issues with gems.

One reply on “Upgrading To Rails 3”

I didn’t have much to upgrade, but following the Rails casts, it went pretty smooth.

Also running everything from Heroku, so no problems with bundler.

Leave a Reply

Your email address will not be published. Required fields are marked *