# Upgrading to Rails 3

**URL:** <https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508>\
**Category:** rubyonrails-talk\
**Created:** [April 6, 2012, 7:35pm UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508 "2012-04-06T19:35:02Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_Dosanjh](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Gurdipe\_Dosanjh](https://discuss.rubyonrails.org/u/Gurdipe_Dosanjh)\
**Post date:** [April 6, 2012, 7:35pm UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/1 "2012-04-06T19:35:02Z")

</div>

Hi All,

Re: Upgrading to Rails 3

I am working on a rails application I need to upgrade to the latest version of Ruby and Ruby on Rails.

It is currently using:

Ruby version 1.8.7 and

Ruby on Rails version 2.3.5

Is there any information, tutorial, guides etc. I can follow

Any help would be greatly appreciated

Kind Regards

Gurdipe

---

<div class="post-metadata">

**Author:** ![Jason\_FB](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/jason_fb/32/826_2.png) [@Jason\_FB](https://discuss.rubyonrails.org/u/Jason_FB)\
**Post date:** [April 6, 2012, 8:16pm UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/2 "2012-04-06T20:16:35Z")

</div>

Check out

[http://guides.rubyonrails.org/3\_0\_release\_notes.html](http://guides.rubyonrails.org/3_0_release_notes.html)

It is my personal recommendation that you do three things:

1. Create fresh new Rails 3 app for yourself to “play around in” first. In fact, you don’t even need to play much, you just need to compare your existing config files to the config files in your brand new rails app. **Moving the Gem version of Rails doesn’t change config settings** , and most of the Rails 3 good stuff is in config settings (like the asset pipeline.) When they say “it works this way by default in Rails 3” – they DO NOT mean you will get that behavior automatically just by moving the Gem version – they mean that when you do “rails new xyz” the default configuration on your newly created app is set that way.

2. Don’t actually upgrade the existing repository. Instead, create a new Rails apps and copy files into it (Controllers, Views, Models, etc) one by one. This is more or less practical depending on your situation, so take this suggestion with a grain of salt. But if you do it this way, you can iteratively test as you make changes to confirm that each page and/or section of your app works.

3. Consider upgrading to 3.0.9 _without_ the asset pipeline first. Then when you have it working in Rails 3.0.9, enable the asset pipeline (in application.rb) and move all the way up to Rails 3.2.1 (or whatever the latest is)

Beyond that, expect to have to:

- Rewrite your routes.rb file (there’s a new syntax)

- Change instances of \<% form\_for … %\> to \<%= form\_for … %\> in views

- Change “named\_scope” to “scope” in models

There’s also an official upgrade path, but I don’t even recommend that either. You’ll learn more about Rails 3 and become a better developer if you do it piece-by-piece, following suggestion #2 above.

-Jason

---

<div class="post-metadata">

**Author:** ![Chirag](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@Chirag](https://discuss.rubyonrails.org/u/Chirag)\
**Post date:** [April 7, 2012, 5:30am UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/3 "2012-04-07T05:30:14Z")

</div>

Hi Gurdipe,

There is a series of RailsCasts that you can watch to get a reasonable idea of how to approach the upgrade.

[http://railscasts.com/episodes?search=upgrading+to+Rails+3](http://railscasts.com/episodes?search=upgrading+to+Rails+3)

Chirag [http://sumeruonrails.com](http://sumeruonrails.com)

---

<div class="post-metadata">

**Author:** ![Gurdipe\_Dosanjh](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Gurdipe\_Dosanjh](https://discuss.rubyonrails.org/u/Gurdipe_Dosanjh)\
**Post date:** [April 7, 2012, 8:10am UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/4 "2012-04-07T08:10:02Z")

</div>

Hi Jason,

Thanks for the awesome brilliant reply, it’s been a great help to me.

Gurdipe

---

<div class="post-metadata">

**Author:** ![Gurdipe\_Dosanjh](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Gurdipe\_Dosanjh](https://discuss.rubyonrails.org/u/Gurdipe_Dosanjh)\
**Post date:** [April 7, 2012, 8:13am UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/5 "2012-04-07T08:13:18Z")

</div>

Hi Chirag ,

Thanks mate, I’ll definitely checkout these rails casts out.

Gurdipe

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [April 7, 2012, 8:25am UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/6 "2012-04-07T08:25:03Z")

</div>

> Hi All,
> 
> Re: Upgrading to Rails 3
> 
> I am working on a rails application I need to upgrade to the latest version of Ruby and Ruby on Rails.

Make sure your automated test coverage is complete before you start, then you can be reasonably confident, when you have finished, that all is working.

Colin

---

<div class="post-metadata">

**Author:** ![Jeffrey](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jeffrey](https://discuss.rubyonrails.org/u/Jeffrey)\
**Post date:** [April 7, 2012, 1:08pm UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/7 "2012-04-07T13:08:53Z")

</div>

Quoting Gurdipe Dosanjh \<rhomobileapps@gmail.com\>:

> Hi All,
> 
> Re: Upgrading to Rails 3
> 
> I am working on a rails application I need to upgrade to the latest version of Ruby and Ruby on Rails.
> 
> It is currently using:
> 
> Ruby version 1.8.7 and Ruby on Rails version 2.3.5
> 
> Is there any information, tutorial, guides etc. I can follow
> 
> Any help would be greatly appreciated

In addition to the other advice, overriding ActiveRecord callbacks was deprecated in 2.3.8. So replace

&nbsp;&nbsp;def before\_save &nbsp;&nbsp;&nbsp;&nbsp;# whatever &nbsp;&nbsp;end

with:

&nbsp;&nbsp;before\_save :whatever

private

&nbsp;&nbsp;def whatever &nbsp;&nbsp;&nbsp;&nbsp;# whatever &nbsp;&nbsp;end

HTH, &nbsp;&nbsp;Jeffrey

---

<div class="post-metadata">

**Author:** ![Jodi](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Jodi](https://discuss.rubyonrails.org/u/Jodi)\
**Post date:** [April 7, 2012, 2:30pm UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/8 "2012-04-07T14:30:57Z")

</div>

I suggest you get your tests in gear if not already

get a core group (start with models, then controllers, minimum of models) passing in 2.3.5

then upgrade

you'll find a great number of plugins and gems will need to be upgraded - and some will have to be hand patched if you cannot find a suitable replacement Jodi

---

<div class="post-metadata">

**Author:** ![Gurdipe\_Dosanjh](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Gurdipe\_Dosanjh](https://discuss.rubyonrails.org/u/Gurdipe_Dosanjh)\
**Post date:** [April 8, 2012, 8:22am UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/9 "2012-04-08T08:22:12Z")

</div>

Hi Colin,

Thanks this point, I am also carrying out a exercise to ensure all the testing is checked and up to date.

Kind Regards

Gurdipe

---

<div class="post-metadata">

**Author:** ![Gurdipe\_Dosanjh](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Gurdipe\_Dosanjh](https://discuss.rubyonrails.org/u/Gurdipe_Dosanjh)\
**Post date:** [April 8, 2012, 8:25am UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/10 "2012-04-08T08:25:30Z")

</div>

Hi Jodi,

Thanks for this great point about testing and plugins that need to be upgraded. Its really helpful

Kind Regards

Gurdipe

---

<div class="post-metadata">

**Author:** ![Gurdipe\_Dosanjh](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Gurdipe\_Dosanjh](https://discuss.rubyonrails.org/u/Gurdipe_Dosanjh)\
**Post date:** [April 8, 2012, 8:54am UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/11 "2012-04-08T08:54:00Z")

</div>

Hi All,

Thanks to everyone for the great updates on how to upgrade to Rails 3.

What are the technical and business benefits of upgrading to the latest versions of Ruby an Ruby on Rails.

The application we have written is still on Ruby version 1.8.7 and Ruby on Rails version 2.3.5

Kind Regards and Thanks in advance

Gurdipe

---

<div class="post-metadata">

**Author:** ![Jeffrey](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jeffrey](https://discuss.rubyonrails.org/u/Jeffrey)\
**Post date:** [April 8, 2012, 12:47pm UTC](https://discuss.rubyonrails.org/t/upgrading-to-rails-3/63508/12 "2012-04-08T12:47:40Z")

</div>

Quoting Gurdipe Dosanjh \<rhomobileapps@gmail.com\>:

> Hi All,
> 
> Thanks to everyone for the great updates on how to upgrade to Rails 3.
> 
> What are the technical and business benefits of upgrading to the latest versions of Ruby an Ruby on Rails.
> 
> The application we have written is still on Ruby version 1.8.7 and Ruby on Rails version 2.3.5

There are no bug or security fixes for 2.x. Nor if I understand the policy correctly, 3.0.x.

I'd suggest moving to 2.3.14 first before jumping to 3.x.

Jeffrey
