views:

1183

answers:

7

I'm developing an application with Ruby on Rails that I want to maintain for at least a few years, so I'm concerned about the next version coming up soon.

Going from Rails 1 to Rails 2 was such a big pain that I didn't bother and froze my gems and let the application die, alone, in the dark.

On this project I don't want to do that. First because this new version looks awesome, but also because this application may turn into a real product.

  • How can I prepare my application so that it will be upgradable with as little changes as possible.

  • How time consuming do you think switching version will be?

  • And what about my server? Deployment?

I'm already looking at deprecation notices... what else can I do?

+2  A: 

I don't think there is going to be a major problem. Going off what was said in that initial report the Rails team realized that they can't do a major rewrite like they did from 1 to 2.

They even say:

I’m sure there’ll be some parts of Rails 3 that are incompatible, but we’ll try to keep them to a minimum and make it really easy to convert a Rails 2.x application to Rails 3.

I would be more concerned going from Merb to Rails 3.

Joe.Cianflone
+8  A: 

The best thing you could do would be to follow development of Rails 3 via blogs and the Github repository and keep up a copy of your app along with it.

The official Ruby on Rails blog is updated with "What's new in Edge" posts every once in awhile. There are other blogs that often write about new things in edge as well. Larger features are often highlighted in these blogs, so you know about all the cool new features you can play with.

I'm not sure how close Rails 3 is to release (last I heard the core team was talking about a release at RailsConf 2009 in May), but you can always freeze the edge version of Rails into your application and just see what breaks. If you are using git, or another DVCS, you might make a branch specifically for Rails 3 and periodically update Rails to the latest edge code. Just be aware that edge Rails is a moving target so things in your app may break or fix themselves as you are pulling in newer Rails code.

Update: Jeremy McAnally has a ton of info on upgrading from Rails 2 to Rails 3 on his blog. http://omgbloglol.com/

Jared
While "cool new features" are often blogged about, the issue will be with deprecations; are people actively blogging about what doesn't/won't work anymore?
Stobor
A: 

For preparing your application, the best way it what Jared said. Follow the Rails3 development.

For the time consuming, I think it depends of how you've followed the rails3 development before it's release.

And for the deployment, it shouldn't take too much problems. Rails 3 will be using Rack. So you can start it with mongrel, passenger or any server/gateway it shouldn't give you any problem.

Damien MATHIEU
+1  A: 

The single most important thing you can do to make it easy to migrate to a new version of rails is to have a comprehensive test suite. Without a good test suite, I would never have the confidence that the new version of rails hasn't broken something in my app. On the current Rails app I'm working on, we started on Rails 2.1.1 back in October of 2008. Since then, we've migrated to Rails 2.1.2, 2.2.2, 2.3.2, 2.3.3 and now 2.3.4. I did the migrations to 2.3.2, 2.3.3 and 2.3.4...and for the 2.3.2 and 2.3.3 upgrades, we had some failing tests that alerted us to problems we would not have discovered without having such a good test suite. The failing tests actually alerted us to a regressive bug in rails that there was a patch for on the Rails lighthouse but that was not included in the release (since it was discovered, right after the release).

Once you've got that test suite in place, just stay current with each rails release (waiting a couple weeks to upgrade is fine, just don't skip any of the releases).

Yehuda Katz (a member of the Rails core team) has stated that there will most likely be a transitional release, containing deprecation warnings and such.

So as long as you have a good test suite to expose the inevitable upgrade problems, and stay current with the Rails release, the migration to Rails 3 should not be too difficult.

Myron
A: 

There are some major changes in Rails 3, I posted about my experience upgrading my app to Rails 3 here: http://rails3.community-tracker.com/permalinks/5/notes-from-the-field-upgrading-to-rails-3

A good start in preparing would be to migrate over to using bundler. And doing a very deep review of strings that will go through the new XSS protection scheme.

Sam Saffron
+1  A: 

There are going to be some automated compatibility checkers. Also, keep an eye on http://www.railsplugins.org/ so that you know if the libraries you depend on are going to be upgraded. The Rails Core team seems to be giving a lot of advance notice to the community this time around, so any lib that is actively maintained should be good to go.

Tim Rosenblatt
http://isitruby19.com/ is also a good site to keep an eye on. Many people will be looking to upgrade to Ruby 1.9 since Rails has 1.9 full compatibility.
Jared
A: 

As simple as:

Great screencasts from Ryan Bates.

tommasop