Rails 3.1 and Ruby EE - ruby-on-rails

Since Rails 3.1 strongly recommends that it be installed with Ruby 1.9.2. But what about Ruby Enterprise Edition support? Ruby EE seems to be in the 1.8.x version, so I guess this means that future rails updates won't be working so well with it?

it's only a recommendation (and I suggest it too), because as you may know, 1.9.2 is the most recent version.
you can still use REE for your 3.1 rails app, but keep in mind that some day you'll be forced to switch to a newer ruby interpreter, and it's not a painless task (even if you have a decent test coverage).
if it's about a passenger matter, don't worry, it will work on 1.9.2 too ;)

if you generate new rails 3.1 app on 1.9 it will use new hash syntax, so you will not be able to easily switch to 1.8 later.
example: config/initializer/session_store.rb uses new hash syntax
YourApp::Application.config.session_store :cookie_store, key: '_yourapp_session'

Our large Rails 3.1 app runs very slowly when we migrated it to ruby 1.9.2
We upgraded it rather than creating from scratch, so maybe we did something wrong, but running it with 1.9 is so slow it's unusable, switching to REE make it run nicely again.

I decided to take the plunge and moved my app over to REE. It seems to work the same, a bitter faster in fact. The memory usage seems about the same. The guys from Phusion did an awesome job with the installer :)

Related

Upgrading from Rails 2.3 to Rails 4.0

We have an application which is currently on Rails version 2.3.12 and Ruby version 1.8.7. We want to update our application to Rails 4.0 and Ruby 2.1.0. We have around 200 models and 150 controllers.
I would like to know how big an effort is it to undergo the upgrade process. Also can you provide steps which can be followed for the upgrade. Should we first upgrade Ruby and then Rails or vice-versa?
What you want to achieve is gonna be an epic effort. I can't provide you the step by step instructions because it's impossible to cover all the cases in a single answer.
I recommend to not upgrade Ruby and Rails in parallels, but in small steps.
The complexity of the upgrade itself is huge, but it's not impossible as long as you have a reasonable test coverage of you application. I really hope you have tests. If you don't, then you can't even think to start an upgrade like this and you first need to ensure a minimum coverage for the product.
My suggestion is to follow this roadmap
Upgrade Ruby from 1.8.7 to 1.9.3. Rails 2.3 is supposed to be compatible with Ruby 1.9 and you'll get the benefit of a more recent Ruby version. In fact, several gems have dropped support for Ruby 1.8.
Leave the app settle and run for a while, just to make sure you can find and fix incompatibilities. Every time you find an issue, reproduce it with a test, then fix it.
Upgrade Rails from 2.3 to 3.0.
Same as point 2.
Upgrade Rails from 3.0 to the latest 3.x version.
Same as point 2.
Upgrade Ruby from 1.9.3 to 2.0. The upgrade should be trivial.
Same as point 2.
Upgrade Rails from 3.x to the latest version
A few notes
The reason I suggested you to not upgrade from Rails 2.3 directly to 4, it's because it's almost impossible.
The reason I suggested you to not upgrade form Rails 2.3 directly to the latest 3.x, it's because from 3.0 to 3.x there is the asset pipeline new feature that is gonna cause you several headaches. It's better to handle this step separately and not in a big upgrade.
Ruby 1.9 handles encoding differently than Ruby 1.8. Rails 2.3 is not well prepared for this.
The issues often lead to hard errors, and may occur at unexpected places (like when you want to show a error message)
A good (or scary) overview is on this blog entry:
http://www.rvdh.de/2010/01/06/why-you-cant-run-rails-23-apps-on-ruby-19/
I also lost a lot of time trying to bring Rails 2.3.x to work with Ruby 1.9.x
(Maybe it is possible if you are always use plain ascii)
So you need first update to Rails 3.0 and then to Ruby 1.9.3 (or both at the same time)
The asset pipeline is nice when it works, but upgrading is difficult enough.
So I would just disable it until you are on Rails 4.0.
There is a lot changed with the views, like form_for helper.
It is good when you have tests that render each view at least once. You then will get deprecation warning for things that have changed.
If this is not realistic, then you should try to test all things of your app manually, and
grep the log files for the deprecation warnings.
Many deprecations in Rails 3.0 will lead to errors or wrong behaviour in Rails 3.1.
For updating the ruby and rails version to new is not take much more time but in your code you have to change all the quires and model scopes and whatever which does't work in new rails version of deprecated in new ruby and rails versions.And one more thing may be many gems which have support to ruby 1.8.7 will not support the new ruby version and same thing for the rail.
My suggestions is just, you first check the dependencies of your application with new versions and the get a decisions.I have knowledge about it because i have also upgrade a full application from ruby 1.8.7, rails 2.3.5 to ruby 1.9.3 and rails 3.2.13.

upgrade from ruby 1.8.7 to 1.9.2

I'm looking to upgrade my rails project from 1.8.7 to 1.9.2, but, when I swapped ruby versions in RVM, I had same issues getting the app started. (mostly with mysql (which... 64bit mysql on mac (any version) is a pain to set up, and almost impossible))...
But anyway, aside from mysql problems, is there anything I would need to change in my code that is no longer supported in 1.9.2?
There is way too many subtle changes to cover in something like SO, but this covers it quite well (I'm not involved in any way):
http://www.rubyinside.com/19walkthrough/
Assuming you're using fairly standard Ruby there shouldn't be anything which will cause problems, but I'm sure your tests will point out anything that needs fixing.

Does ruby 1.9.2 fully supports rails 2.3.x projects?

ruby 1.8.7 does not compile well under Lion and Xcode 4.2. I'd like to know whether ruby 1.9.2-p290 fully supports rails 2.3.5 and/or 2.3.11?
It's more a question if Rails is supported on Ruby 1.9.2 - but yes, it should run fine on Ruby 1.9.2 - also you need to ensure that Gems you are intending to run work on both Rails 2.3.x and Ruby 1.9.x which will be down to each gem individually.
There were some problems with the new encoding features in 1.9.2 in some older versions of rails. You should use the newest version of rails 2.3.x also for security reasons...
Another (slightly older) resource for checking out whether your associated gems might work is IsItRuby19. It hasn't been getting as much traffic as it did in the past, but when assessing whether Rails 2.x apps would work on 1.9.x Ruby, it might help flesh out the rest of your stack. It has a few notes about the Rails gem set-proper (somewhat stale), and some current notes about many other common gems.
Might save some research time or get pointers before tracking down lots of release notes.

Should I use Ruby 1.9.2 with my new web app?

Starting a new web app with Rails 3. I'm still relatively new to web development and have really enjoyed all the internet resources available to me while working in Ruby 1.8.7 and Rails 2.3.5. Any advice against using Ruby 1.9.2 on my new project?
I have been successfully converting all my Rails projects (except one, but I'm working on it) from Ruby 1.8.7/Rails 2.3.5 to Rails 3.0.0 and Ruby 1.8.7/1.9.2 RC2 and both environments are pretty stable.
Fortunately, things changed since I posted this question.
Rails
Unless you really have something that prevents you to do that, I strongly encourage you to start with Rails 3.
The effort required to upgrade an application from Rails 2 to Rails 3 should discourage you from starting from Rails 2.
Talking about plugins and Gems, many developers are starting to convert their libraries to Rails 3. Currently there's a very high level of compatibility.
Furthermore, Rails 3 focused plugins tends to be quite more powerful to the Rails 2.3 ones, thanks to the new Rails plugin API. They can load tasks, they no longer abuse monkey patching or rely on internal hacks.
Also, Rails 3 is just around the corner. Unless your project will be deployed in 1 week, the stable version will probably available before you deploy your code.
I this would not happe, consider that I'm currently managing a couple of Rails 3 project in a production environment and they are pretty stable (Rails 3 RC1, the Beta 4 has a really weird bug in the caching environment).
Ruby 1.9.2
Ruby 1.9.2 is way more powerful than Ruby 1.8.7. If this is a brand new project, I suggest you to use the 1.9 branch.
Usually, it's more easy to start a new project in Ruby 1.9 than converting an existing one.
Ruby 1.9.2 is faster, even more faster than REE. The most part of the common Ruby 1.8.7 Gems work with Ruby 1.9 except a few ones, such as RCov.
Again, it's very hard you're going to need a library which doesn't work with Ruby 1.9.2.
If it happens, chances are this is an outdated library and a better replacement is probably available in the Ruby ecosystem.
If you can't find an alternative, remember that Rails 3 provides an excellent way to use custom libraries, thanks to Bundler.
You can fork the project and ask Bundler to use your fork. You can even integrate the library in your repos and ask Bundler to load the library from a path.
Conclusion
From my personal experience, I've been very happy with Ruby 1.9.2 and Rails 3.
This is by far my favorite environment and my default environment for new projects.
If you can't use Ruby 1.9.2 try with Ruby 1.8.7.
On the other side, I strongly encourage you to start with Rails 3.
It ultimately depends on what the project is. If it is a personal project, and you are using it as a means to learn Ruby/Rails, than I think it would be worth learning and using the latest tools. If this is client work, or a project that your main goal is just to complete the thing, 2.3.5 / 1.8.7 would probably be the best choice, because of resources as you mentioned, and a lot of supporting libraries/gems will just work. You will have to learn Rails 3 / Ruby 1.9.x at some point because that's definitely where the community is headed.
I would do some research and see what gems you will need for your project, and make sure that everything is supported if you choose the Rails 3 / 1.9.2 route. Also, join the irc and ask around about other people's experience with whatever gems are in question.
I can tell you that I have a small Rails 3 / 1.9.2 application that runs just fine in production, although it is very small and a personal project.
You might want to try out Ruby 1.9.2 by using RVM
I've been using it off and on to develop some Rails3 apps while maintaining our current production sites (all the way down to Rails 2.2 / Ruby 1.8.5).
Only gripe being having to remember to start RVM up ^^

Can Ruby 1.9 used with Rails by a Ruby/Rails beginner?

About half a year ago, when I started to learn Ruby and Rails, I first tried Ruby 1.9 but I soon gave up, because at that time nothing worked out of the box and almost every helping blog or tutorial was designed for Ruby 1.8.
What about now? (Dec 2009) Is it possible to get an existing Rails application running by a Ruby and Rails beginner without running into problems which can only be fixed by an absolute Ruby and Rails professional?
Unfortunately I dind't have good experiences with Ruby 1.9 and Rails.
You can read more here: Has anyone successfully deployed a Rails project with Ruby 1.9.1?
My opinion is that migrating an existing Rails app from Ruby 1.8.x to Ruby 1.9.1 is not as easy as you would think, event with an excellent test suite.
I'm also quite sure that most of the problems arise from trying to convert an existing application because you are working with an established code base.
Starting with a new Rails app with Ruby 1.9 should probably easier because you can trace a problem as soon as you write a single line of code so you can easily isolate which component is not compatible.
When migrating an existing app I had hard time trying to figure out which stack level was actually not compatible with Ruby 1.9. And there are more than one incompatible libraries at the same time I can't tell you how it's difficult to understand which one should be fixed first and which one originated the final error.
In 99.9% of the cases yes, there were rare cases where u might find problems but they should be solved with the new release.
As for the external gems and plugins, most of them now are fully compatible with ruby 1.9, however sepcial cases might exist but I'm not aware of any right now.

Resources