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 somenone
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 namedconfig/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 becomexhr :get, :whatever, :format => :js