Updating to rails 2 2 2

In this article, I’ll try to cover all the issues that I had, when I was upgrading one of my Rails app from Ruby on Rails 4.2 to Ruby on Rails 5.0.Note: This is not a complete, covering every possible case tutorial. If so, feel free to comment and I will try to update the post with other issues and solutions. If you don’t have a good code coverage level and you lack tests, upgrading from Rails 4.2 to Rails 5 might be a big problem.After updating your Gemfile you can do a allow it to overwrite your files and then just add the stuff that was gone (git diff).IMHO it is way less complex approach, that trying to add all new config options manually.In my case, following files were affected: On branch rails5 Changes not staged for commit: modified: bin/rails modified: bin/rake modified: config/modified: config/modified: config/environments/modified: config/environments/modified: config/environments/modified: config/initializers/modified: config/initializers/cookies_modified: config/initializers/session_modified: config/initializers/wrap_Untracked files: bin/setup bin/update config/initializers/application_controller_config/initializers/backtrace_config/initializers/config/initializers/config/initializers/mime_config/initializers/request_forgery_config/redis/ However not all the changes are worth being mentioned (sometimes there were just comments changes).If you didn’t have any custom stuff there, just go with the flow ;) I’ll just quote the comment from (although it is not a new feature it is still worth reminding): Settings in config/environments/* take precedence over those specified here. There’s something quite interesting in new development.rb: feature toggling.Currently there are some gems incompatibilities (I will cover them later) and with some, you need to go edge.Here’s a list of gems that I had to switch to edge (or use a specific version) in order to get things running: gem 'rails', '5.0.0.beta1' gem 'devise', github: 'plataformatec/devise' gem 'responders', github: 'plataformatec/responders' gem 'ransack', github: 'activerecord-hackery/ransack' gem 'kaminari', github: 'amatsuda/kaminari' gem 'mailboxer', github: 'mailboxer/mailboxer' group :test do gem 'rspec', github: 'rspec/rspec' gem 'rspec-mocks', github: 'rspec/rspec-mocks' gem 'rspec-expectations', github: 'rspec/rspec-expectations' gem 'rspec-support', github: 'rspec/rspec-support' gem 'rspec-core', github: 'rspec/rspec-core' gem 'rspec-rails', github: 'rspec/rspec-rails', branch: 'rails-5-support-patches' gem 'rails-controller-testing' end Note that I’ve added a rails-controller-testing gem.


This gem brings back assigns to your controller tests as well as assert_template to both controller and integration tests.If you use those methods, after upgrading to Ruby on Rails 5, you will have to add it.This is a really good feature that finally allows to drop some “bypass like” solutions.If you didn’t render outside of controllers scope, you can leave this commented. Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.

Application configuration should go into files in config/initializers all files in that directory are automatically loaded. If you have any custom stuff in – just move it to initializers. Thanks to some files that are in tmp/ you can disable/enable some features to test them in the dev mode, without having to switch to production mode (for example caching).

# Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. # config.file_watcher = Active Support:: Evented File Update Checker New initializer configuration for application controller renderer.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>