Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade from Rails 3.2 to Rails 4

I have an application in Rails 3.2 which is ready to deploy. I am wondering should I upgrade it to Rails 4 or not. I also not sure about which of the gems might give issues with while upgrading.

Below is my Gemfile with several common gems.

Gemfile.rb

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'pg', '0.12.2'

gem 'bcrypt-ruby', '3.0.1'

gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'simple_form', '2.0'
gem 'rails3-jquery-autocomplete', '1.0.10'
gem 'show_for', '0.1'
gem 'paperclip', '3.3.1'
gem 'cocoon', '1.1.1'
gem 'google_visualr', '2.1.0' 
gem 'axlsx', '1.3.4'
gem 'acts_as_xlsx', '1.0.6'
gem 'devise' ,'2.1.2'
gem 'cancan', '1.6.8'
gem 'bootstrap-datepicker-rails', "0.6.32"
gem 'country_select', '1.1.3'
gem 'jquery-rails', '2.1.4'
gem 'annotate', '2.5.0', group: :development
gem 'ransack', '0.7.2'
gem "audited-activerecord", "3.0.0"
gem 'prawn', '1.0.0.rc2'
gem 'exception_notification', '3.0.1'
gem 'daemons', '1.1.9'
gem 'delayed_job_active_record', '0.4.3'
gem "delayed_job_web", '1.1.2'
gem "less-rails"
gem "therubyracer"
gem 'twitter-bootstrap-rails', '~>2.1.9'
gem "spreadsheet", "~> 0.8.8"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '1.2.3'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

group :development, :test do
  gem 'rspec-rails', '2.11.0'
end

group :test do
  gem 'capybara', '1.1.2'
  gem 'factory_girl_rails', '4.1.0'
  gem 'faker', '1.0.1'
end

I started working on this application last year (Nov 2012) after reading this great book at http://ruby.railstutorial.org/. I have also checked out what's new in Rails 4 like strong parameters and it's all very tempting to try an upgrade.

But I am concerned about compatibility of these gems and effort it may take.

I need some advice from experienced guys in the community or someone who has tried upgrading before I move ahead.

like image 350
Bot Avatar asked Aug 18 '13 22:08

Bot


People also ask

How long does it take to upgrade Rails?

Depending on the complexity of your app, a Rails upgrade can take anywhere from one week for a single developer, to a few months for two developers.


3 Answers

I uploaded your gemfile to Ready for Rails 4, and it appears that you only have a couple gems that are not ready and one gem that is unknown. For some of the gems listed that do not have notes, I would suggest checking out their GitHub page (if they have one), and see if the gem has been updated recently on rubygems, just to confirm whether or not the gem works.

like image 179
jvperrin Avatar answered Oct 03 '22 16:10

jvperrin


The asset pipeline has changed a bit, so you'll need to upgrade those gems. I had to use a fork of ransack in the context of active_admin, but you might be fine.

I'd recommend that you create a branch, bump to Rails 4, and see what happens. It took me a day or two to upgrade from 3.2 to 4 a couple weeks ago on a fairly small (but production-with-customers) application. The upgrade guide is pretty solid.

like image 40
Kyle Avatar answered Oct 03 '22 15:10

Kyle


This brief handbook was worth every cent in our recent 3.2 to 4 migration.

https://leanpub.com/upgradetorails4

https://github.com/alindeman/upgradingtorails4

It lists in details how to handle gem upgrades, as well as individual details (with clear examples) of what's changed and how to manage your current Rails app through the upgrade.

To address your gem-specific concerns: Almost all our 40+ gems, except perhaps 5, had active either Rails 4 releases (or Github branches for Rails 4), or worked just fine with Rails 4 when left intact.

Having a healthy unit/functional test suite in your codebase would be vital for your confidence in the upgrade being successful.

like image 31
changingrainbows Avatar answered Oct 03 '22 14:10

changingrainbows