Re: Upgrading to Rails 3

10 views
Skip to first unread message

Gurdipe Dosanjh

unread,
Apr 6, 2012, 3:35:02 PM4/6/12
to rubyonra...@googlegroups.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

Kind Regards

Gurdipe

Jason Fleetwood-Boldt

unread,
Apr 6, 2012, 4:16:35 PM4/6/12
to rubyonra...@googlegroups.com


Check out 


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




--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/-GwOpn34jqsJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Chirag Singhal

unread,
Apr 7, 2012, 1:30:14 AM4/7/12
to rubyonra...@googlegroups.com
Hi Gurdipe,

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

Gurdipe Dosanjh

unread,
Apr 7, 2012, 4:10:02 AM4/7/12
to rubyonra...@googlegroups.com

Hi Jason,


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


Gurdipe

Gurdipe Dosanjh

unread,
Apr 7, 2012, 4:13:18 AM4/7/12
to rubyonra...@googlegroups.com

Hi  Chirag ,


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


Gurdipe

Colin Law

unread,
Apr 7, 2012, 4:25:03 AM4/7/12
to rubyonra...@googlegroups.com
On 6 April 2012 20:35, Gurdipe Dosanjh <rhomob...@gmail.com> wrote:
> 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

>
> 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
>

> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/-GwOpn34jqsJ.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.

--
gplus.to/clanlaw

Jeffrey L. Taylor

unread,
Apr 7, 2012, 9:08:53 AM4/7/12
to rubyonra...@googlegroups.com

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

def before_save
# whatever
end

with:

before_save :whatever

private

def whatever
# whatever
end

HTH,
Jeffrey

Jodi Showers

unread,
Apr 7, 2012, 10:30:57 AM4/7/12
to rubyonra...@googlegroups.com
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

> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.

Gurdipe Dosanjh

unread,
Apr 8, 2012, 4:22:12 AM4/8/12
to rubyonra...@googlegroups.com
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

Gurdipe Dosanjh

unread,
Apr 8, 2012, 4:25:30 AM4/8/12
to rubyonra...@googlegroups.com
Hi Jodi,

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

Kind Regards

Gurdipe

Gurdipe Dosanjh

unread,
Apr 8, 2012, 4:54:00 AM4/8/12
to rubyonra...@googlegroups.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

Kind Regards and Thanks in advance

Gurdipe

Jeffrey L. Taylor

unread,
Apr 8, 2012, 8:47:40 AM4/8/12
to rubyonra...@googlegroups.com
Quoting Gurdipe Dosanjh <rhomob...@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

Reply all
Reply to author
Forward
0 new messages