Hugo Corbucci's Blog

Showing all posts tagged #rails:


Notes on upgrading from Rails 4.1 to 4.2

Posted on January 21st, 2015

This one is a fairly easy upgrade although it was a little hard to discover all the issues. The main work was around removing Inherited Resources.

Here are more detailed notes:

  • All calls to .deliver become .deliver_now. Including in your tests and stubs. If you had any tests that depended on the code block to be executed, you have to call .deliver_now as method...


Notes on upgrading from Rails 4.0 to 4.1

Posted on January 14th, 2015

This upgrade was fairly easy. The thing that will potentially give you more work are tests around ajax requests.

Here are the few detailed notes:

  • ActiveModels now includes a none scope by default. So if you have some none scope defined, just remove their definitions.
  • The state machine gem has not been updated for Rails 4.1 yet. Rails 4.1 made private the around_validation method in ActiveModels. Since state machine uses this method to inject its own validations, you need an extension for it. I’ve created a file named config/initializers/state_machine.rb and added the following code:
    module StateMachine::Integrations::ActiveModel; public :around_validation; end
  • CFRS is also possible in AJAX request. Because of this AJAX requests are checked against it as well as of Rails 4.1. Therefore, in your tests, get :whatever, :format => ‘js’ has to become xhr :get, :whatever, :format => :js

Notes on upgrading Rails from 3.2 to 4.0

Posted on January 7th, 2015

The upgrade itself is not that hard. The main thing is the change from models protected from mass-assignment to strong parameters in the controllers. The rest is fairly quick and simple.

Here are more detailed notes:

  • Strong parameters: Use the gem in 3.2 and move any attr_accessible out of your models. Ensure you added the config.active_record.whitelist_attributes = false to your...