How should i update my existing app from rails 4.0 to rails 4.1 . i know i have to update the gem . Is there also any other configuration to modify in the app.
This is how I'm doing it:
See that you have a sufficient test suite and that all tests pass
Review your Gemfile. What needs to be updated to be Rails 4.1 compatible?
Update them now; see that your test suite still passes
Use railsdiff.org to see the basic changes to a new rails app and apply them accordingly
http://railsdiff.org/diff/v4.0.3/v4.1.8/
Follow the official Rails guide for upgrading to Rails 4.1
http://guides.rubyonrails.org/4_1_release_notes.html
Google for more guides on upgrading to Rails 4.1
https://www.google.com/search?q=upgrade+to+rails+4.1
They mention some more things you have to take care of when upgrading to Rails 4.1.
Especially mentioning some non-default gems, like Rspec etc.
Run your test suite, see that all tests pass. Update or fix your code if necessary.
Take a look at the Ruby on Rails guide for upgrading. It depends on how your app is built already.
Related
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.
Has anyone tried JasminRice gem with Rails 4?
I've got Ember Rails 4 app and I would like to use Jasmine Rice but I'm not sure whether it would work out well as their Github account says Pain free coffeescript testing under Rails 3.1
Jasmine Rice
I would advice you to use jasmine-gem, which recently gained Rails 4 support. jasmine-gem is developed by Pivotal, the company that develops Jasmine itself, and is actively maintained. While this gem was very basic for a long time, it has improved tremendously, especially with version 2.0.0. Spec execution in Phantomjs (in addition to the browser, which is the fastest for development) is supported, and there is full integration into the Asset Pipeline, which lets you e.g. write tests in CoffeeScript. At my student job, we are using jasmine-gem extensively and are very happy with it.
In the jasminerice installation section they mention that it should work on rails 4:
This gem has been tested and run with Rails 3.1 and 3.2. It should
also run on Rails 4.
"Should" is not as strong of a word as I would like, but I have a ember rails 4 app and jaminerice has not given me any issues.
I am running an application on Rails 2.3.8. I am planning to upgrade it to Rails 4.0 (which is in RC). What will be the easiest way for me to do this? Do I need to first upgrade to Rails 3.x?
Note: in my current implementation, I am using starling and ferret; as part of upgrade I am also considering to move to sidekiq and sunspot
This is a multi-step process, and depending on the size of your application, it can take a long time. At each step, you'll want to test your application for bugs and problems and broken gems (because they are most certainly going to crop up). I have included links for the most complicated steps. Here is the path of least pain:
Update to Rails 2.3.18.
Update to Ruby 1.9.3.
Update to Rails 3.0.
Part 1
Part 2
Part 3
Update to Rails 3.1.
Update to Rails 3.2.latest.
Update to Ruby 2.0.latest.
Update to Rails 4.0.
Update from Rails 4.0 to Rails 4.1.
Update from Rails 4.1 to Rails 4.2.
Update from Rails 4.2 to Rails 5.0.
Update from Rails 5.0 to Rails 5.1.
Bonus: If you have a large application, this is going to take a long time. If you have a large team, long-running branches become a huge headache because of recurring merge conflicts. One strategy for mitigating this is to dual boot your application with both versions of Rails so that you can have the new version running on your master branch, rather than on a long-running branch of its own.
Aaron Gray's answer is very useful, but sometimes it's very difficult after upgrading to find the differences between rails version in the code. I mean, many times after upgrading something doesn't work. Maybe could be some changes in the file or some file could be added or removed in newer version. There is a nice tool, how you can find out all differences between version and compare them. It's on Rails differences and could be very helpful to discover some potential mistakes and bugs.
I have created a project using rails 2.3.8.. Now i need to move rails 3.x.x ..so how can i upgrade my project also?
please tell some tutorial or link to upgrade this?
Start by using the rails upgrade gem. There are several tutorials out on the web that can walk you through what you need to do.
Most importantly, TEST your app thoroughly after doing so.
I have a rails 3 app, and I want to use a plugin that requires rails_generator, which is no longer available in rails 3. Can I have the plugin run with Rails 2, and my app run with Rails 3?
EDIT:
I asked on IRC (#rubyonrails) and the answer is no :(
Rails 3 has a generator. Depending on the rest of the plugin though you might have to make modifications to make it Rails 3 compatible. You can run the generator like this:
rails generate ...