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
nonescope by default. So if you have some
nonescope 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_validationmethod 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.rband 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