Compatibility of Rails 4 engine with Rails 3 or higher version - ruby-on-rails

I need to develop a rails app. I am confused on which version should I use for develop 4.2 or 3.2.
If I develop on Rails 4.2 will it be compatible with Rails 3 or higher version because we are developing the app as a product.

I don't understand well your issue. Are you developing from scratch? Then you should use the last stable version (4.2) because you will have support for a longer time. Anything that you code and test will work.
Version problems come when you already have some code and want to update your Rails version while keeping old code, example: You have an old Rails 3 app and for some reason you want to migrate it to Rails 4.
Even then, if you have different existing rails apps in your server, you can use RVM to have them all living at the same time.
It seems there are some concepts missing here: The main problem you have is with your Gemfile and probably some of the new syntax introduced in Rails 4. You just shouldn't be moving code between Rails app which have different versions, that's all.

Related

Why upgrade an application to latest version of Rails?

I'm just trying to understand the factors that are considered to decide that an application written in a lower version needs to be upgraded.
I would like to think it comes down to these factors:
The Rails team is pretty active and they remedy Rails core security issues as soon as they come across one. It would be nice to have your Rails version always updated which means your have all the security issues of the past addressed as well as open to further updates if they come along. You would not want an older version of Rails get in the way of a security update.
There are always performance improvements in almost every new version of Rails and optimization is an area to work in for Rails apps. You should take advantage of them by keeping your Rails version updated.
Its not only the Rails version, the underlying Ruby version also receives updates and performance improvements. The updated version of Rails makes use of these.
There is also the gem dependency issue. Gems also receive updates and security patches and at times, newer versions of these gems are not compatible with an older version of Rails.
It is easier to upgrade a Rails application to its next version than to its next|next|next|next version. Blog posts and migration guides are always online but if you are coming from a very very old Rails version, they will become very hard to follow.
Newer versions of Rails provide functionality that is not available in the older versions of Rails. It is always nice to have this functionality at your disposal. You never know you may need it in your project.

Suggestions required to convert ruby 1.8.x to 4.1 version

I have developed application on rails 1.8.7 three years back. Now i would like to convert it to latest version of rails.
Can you suggest steps to convert to latest version ?
As Pavan already said, you probably mean Rails 4.1. Was your application developed with Rails 3.2? If so, check out this upgrade guide: http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0 You should upgrade from 3.2 to 4.0 first and then use the advantages of 4.1.
Of course, a decent test coverage helps you to reduce time spent on debugging and error finding.
Also you need to upgrade your Ruby version to at least 1.9.2 (2.1.0 is better). This should not introduce any errors to your code.
edit:
If you are absolutely sure you have Rails 1.2.5, it will actually be too old to upgrade it. You need to upgrade it to every major version and see if everything is stable. I assume the effort to reimplement it in Rails 4 directly is not much larger.

which version of rails should I use for a new project

I have been working with rails 2.3.5. I am gonna start a new project on rails. Should i continue using the earlier version or should i hop on to rails > 3 ? If so which is the more stable version?
It is better to use rails 3.0.x version as these days lot of new plugins(like active_reload) are targeted only for 3.x version.
3.1.x have lot of cool features(like asset pipeline, saas integration, coffescript integration, etc), but its still a release candidate and I faced some issues while using it. I guess we have to wait for the stable 3.1.x release.
I have been using 3.0.7 for a while and found it to be very stable.
3.0.10 is recently released and you can easily upgrade to it from 3.0.7 any time you want in the future.
If you are stuck to 2.x version you will be missing cool features like mentioned here: http://net.tutsplus.com/tutorials/ruby/5-awesome-new-rails-3-features/
For a new project, I would use Rails 3.1 or for a bit more stability, 3.0.7. There are some noticeable differences compared to 2.3, but it will be supported for longer and most development of new gems and documentation are being written for Rails 3.
You should definitely NOT use 2.3 and earlier.
The Rails framework is improving at a steady pace and if there is a downside to that is that it can be a pain to upgrade from version to version, especially as regards to major version changes which introduce tons of backward incompatibilities.
Why then would you want to put yourself in the hole at the get go.
Another issue is how ready and mature is the ecosystem (ruby, popular gem packages, etc.). This leads you to consider whether you should start with 3.0.10 or 3.1 release candidate.
It turns out the great majority of gems working with Rails 3.0 is also working fine with Rails 3.1.
The little downside is that 3.1 is still in release candidate status but it's all but ready for final release and that should come within a matter of days or maximum a couple weeks (as of today Aug. 25, '11).
I would strongly recommend you start all new apps with 3.1. That's what I'm doing.

Compatibility of Rails 2.3.8 with 3.0.1

Does all Rails 2.3.8 projects are compatible with Rails 3.0.1 and vice versa or both must be different?
If they are different means not compatible then is there any tool available which can help me convert a project made in 3.0.1 into 2.3.8 or have to do it manually?
Rails 3.0 is not backward compatible with Rails 2.3.x. Likewise, in order to upgrade a Rails 2.3 project to Rails 3.0 you might need to apply some changes.
Generally speaking, Rails 3.0 is a major version upgrade and contains several new features. You cannot simply change the underlying framework version because the two releases have several differences.
The rails_upgrade Gem can help you upgrading your Rails 2.3 project to Rails 3. I also wrote an article about making your Rails 2.3 project more Rails 3 oriented in order to have an easier transition.

Simple Question: Is Rails 2.3.4 backward compatible with Rails 2.3.2?

A client is indicating that the Rails version I have installed on my Ubuntu servers (2.3.4) is not backward-compatible with the older Version 2.3.2.
I want to know if that is true or not before I attempt to install the older Rails.
the beauty of rubygems. just install both versions and have them specify which version in their environment file problem solved who cares if its compatible or not
New features are never backward compatible.
Well, it is possible that you are using features that are only available on version 2.3.4 , and therefore they're not on version 2.3.2.
Check its changelog to see the differences.
Upgrading between even minor Rails versions often causes problems with old apps.
That said, 2.3.4 is the current recommended stable version so it would probably be worth biting the bullet and getting the 2.3.2 app running on it. Probably won't take very long, if you've got a decent test suite.
There are also a few of bugs that are introduced. Like this one I found involving named scopes using includes. That was introduced in 2.3.3 and wasn't fixed in 2.3.4
2.3.2 => 2.3.4 has been the most painless upgrade so far for us (large app with lots of legacy, rails 1.x code).
The only major issues we had were with after_initialize vs exists?.
It all varies app by app. If you are hosting a client's app, then you should provide gems of all rails versions (they will happily sit side by side (90% of the time)).

Resources