开发者

Should I use Ruby 1.9.2 for my Rails 2.3.10 app?

I have an existing Rails 2.3.10 app that I'm considering upgrading to Ruby 1.9.2 from 1.8.7. Before I start hacking away at the application trying to get it to work, I'm trying to decide if it's even worth the effort.

Just to get an idea of how much work might be involved, I'm simply running all the specs (rspec 1.3.1) in Ruby 1.9.2. 98% of the tests are passing, but they run about 3x slower and there are a ton of messages like "Ruby 1.9 doesn't support Unicode normalization yet". I found a post about this issue, so I know I can fix it, but I'm concerned about the speed and other issues I might run into.

开发者_Go百科

My other option is to upgrade the application to Rails 3 and move to 1.9.2 at that time. This seems like a much better decision for the long term, but could potentially be a lot more work.

tl;dr - Should I upgrade to 1.9.2 now or wait until the application is on Rails 3?


I would recommend doing both, but the order in which you do them, or if you do them both at once is really a personal preference. If you have a strong test-suite with good coverage this is a great first step in making the transition. The main road-blocks you'll run into are the following:

  • Many newer gem versions only support Rails 3, so if you are only doing one step at a time, make sure that you're gems are supported. For example you don't want to get stuck in a situation where a gem requires you to upgrade because you are using Ruby 1.9.2 but the new version of the gem is only available in Rails 3.
  • There are some syntax changes in Ruby 1.9.2 and compiled C extensions need to be re-complied or the gems re-installed.
  • There are major application configuration changes from Rails 2.3 to Rails 3.0. They take some time to complete but there is lots of support.

In general Ruby 1.9.2 will be faster than Ruby 1.8.7 and will provide some cool new syntax. If you are getting opposite results then I would benchmark your code and make sure that this is actually the case and that it's not just failing tests that are slowing your suite down.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜