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.
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.
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.
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.
Related
I am building a rails app and was using rails 4.0.1.
I had an error and noticed that it was mentioned as a bug on rails 3 months ago so I decided to: bundle update and got rails 4.0.3
after doing so neither the tests nor the server would start and they throw an error:
gems/railties-4.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' for # (NoMethodError)
For the moment I commented out the action_mailer lines in the config/environments/* but it would be good to find a real solution.
Searching on Google didn't yield anything regarding this specific error.
Please let me know if I can provide any more detail.
Thank you very much.
UPDATE: here is my Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
gem 'bootstrap-sass'
gem 'bootstrap_form'
gem 'coffee-rails'
gem 'rails'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.1.2'
group :development do
gem 'sqlite3'
gem 'thin'
# gem "better_errors"
gem "binding_of_caller"
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'rspec-rails'
gem 'pry'
gem 'pry-nav'
end
group :test do
gem "faker"
gem "capybara"
gem "database_cleaner"
gem "launchy"
gem 'shoulda-matchers'
gem "selenium-webdriver"
gem "fivemat"
gem 'fabrication'
end
Solution found, in case anyone lands here:
The main issue was that in my Gemfile as you can see no specific gem version was set (apart from bcrypt)
Somehow this makes bundle installs outdated versions under circumstances that are not yet clear to me.
Steps to fix:
completely remove the gemset (if you are using one) or uninstall all
gems
remove the Gemfile.lock
specifiy what version of rails you need e.g. 'rails', '~> 4.0.3'
bundle install
you are set :)
in my case I had installed the gems and since the devkit was not installed properly the gems did not compile.
After setting up the devkit I had to uninstall all of the rails gems (actionmailer, activerecord, actioncable......) and then install rails again.
Then it worked.
This question already has answers here:
Does compass-rails support Ruby on Rails 4.0?
(6 answers)
Closed 9 years ago.
I read that compass for rails 4 is not ready, but its work with "2.0 alpha"... I don't understand.
Has anyone solved this problem it?
my Gemfile
gem 'sass-rails'
gem "compass-rails" #or gem "compass-rails", "~> 2.0.alpha.0"
my application.css.scss //no error, rails recognize the directory
#import "compass";
my error for my first mixin test
Sass::SyntaxError at /partners/dashboard
Undefined mixin 'border-radius'.
Not ready for Rails 4.0:
http://ready4rails4.net/gems/compass-rails
And the contributors were clear on that 9 months before Rails 4 dropped:
https://github.com/Compass/compass-rails/pull/59
I have updated from Rails 3.2 to Rails 4.0 including the gem compass-rails. I have pasted in my gem file below.
I updated as many gems as possible but a couple could not get very latest versions.
The command "bundle outdated" gives you an idea about outdated gem
Pierre
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails_12factor', group: :production
gem 'rails', '4.0.0'
gem 'pg'
gem 'thin'
# do I need this gem for form backing objects
gem 'virtus'
gem 'jbuilder', '~> 1.2'
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem "compass-rails", '~> 2.0.alpha.0'
gem 'uglifier', '~> 2.2.1' # java script compression
gem 'rspec-rails'
gem 'debugger'
gem 'better_errors' # railscast 402
gem 'binding_of_caller'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.0.0'
# tried this update but got errors so backed out
# gem 'bcrypt-ruby' '~>3.1.2'
# paging, searching
gem 'will_paginate', '~> 3.0'
gem 'ransack'
gem "redcarpet", '~> 3.0.0'
gem 'cancan'
gem 'simple_form'
# For drill evaluation- railscast 326
gem 'active_attr'
# For db population
gem 'seed_dump'
# longitude and latitude
gem 'geo_position'
It's not good to use #import in a .css file. You need to rename it to application.css.scss. But I prefer to import compass directly in the files where I need it. And Also I prefer to import only the parts I really need like compass/css3 so that I don't include anything I don't really use.
If that does not help with your problem, you might need to paste in the /partners/dashboard styles to see what's in there.
My first Rails project deploy, and I've run into an issue.
The project is Rails 3.2.1, Ruby 1.9.3
Yesterday, I was given the hosting access, and they're having Rails 2.3.3, Ruby 1.8.7
If I'll decide to still deploy the app there, what changes do I need to make to it?
Specifically, I'm interested in Gemfile changes.
Here's my current gemfile:
source 'https://rubygems.org'
gem 'rails', '2.3.3'#'3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'haml-rails'
gem 'haml'
gem 'omniauth-twitter'
What do I need to change? How do I look-up all the required dependencies and gems versions for old Rails versions?
Downgrading from 3.x to 2.3 is the dumbest thing you can do in your case.
Install gems locally, or ask your hosting company support department — they have to help.
If you can't, save your time — use Heroku, OpenShift or any other hosting company.
I made a new rails 3.2.8 app and added:
gem "rmre", "~> 0.0.4"
to this new gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem "rmre", "~> 0.0.4"
# 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'
Running bundle install yields:
Bundler could not find compatible versions for gem "erubis":
In Gemfile:
rmre (~> 0.0.4) ruby depends on
erubis (~> 2.6.6) ruby
rails (= 3.2.8) ruby depends on
erubis (2.7.0)
I tried commenting out the version numbers and even removing the gems related to asset management. Still, I can't seem to arrive at a combination of gem versions that work here. It's the first time I've run into this sort of situation and I am not sure what else I might do to try out the rmre gem with a version of rails that is at least 3-point-something.
Is there a clever way to search for a workable dependency resolution here? If there is not a gem version configuration that meets the recommended dependencies, is there a least-bad approach to pursue?
Many thanks!
You might try contacting the rmre gem author to see if they would be willing to loosen the dependency restriction, so that it's not tied to such a narrow erubis version. Forward compatibility is part of what gem authors need to maintain if they want their gem to continue to work with the latest versions of rails. – normalocity Nov 2 at 1:31
.
.
Worked.
Download the zip file from the page. Then execute the gem command. Worked for me. Incredible program.
Firstly, Im a big fan of sphinx search. Thanks to sphinx.
Now my question is,
We are ready with a rails 3.1 app which uses sphinx search for full text searching.
Now, I know heroku is the best when it comes to rails hosting. It does not have support
for sphinxsearch, I hear.
If any of you know the right place to host a rails 3.1 app with sphinx search please
guide me.
I will mention the other things that Im using in my rails 3.1 app as listed in my gem
file.
#############################################################
source ' http://rubygems.org '
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'execjs'
gem 'therubyracer'
gem 'thinking-sphinx', '2.0.10'
gem "gritter", "1.0.1"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'
gem 'client_side_validations'
gem "bcrypt-ruby", :require => "bcrypt"
#############################################################
Thank you so much.
Actually, Heroku does support Sphinx through the Flying Sphinx add-on. Otherwise, any decent VPS should work for you. Linode, in particular, has a pretty good reputation.