Railsのバージョンを 4.1.5 から 4.2 にあげたときのメモ

Railsのバージョンを 4.1.5 から 4.2にあげたときのメモです。

railsをアップデートする

Gemfile

#gem 'rails', '4.1.5'
gem 'rails', '~> 4.2'
$ bundle update rails
$ bundle clean

Gemのインストールは完了。
WEBrickを起動してみます。

$ bundle exec rails s -b 0.0.0.0
=> Booting WEBrick
=> Rails 4.2.5 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/var/share/sample_app/vendor/bundle/ruby/2.2.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:457:in `ensure in with_devise_exclusive_scope': undefined method `merge!' for #<ActionDispatch::Routing::Mapper::Scope:0x007f47d1c79e60> (NoMethodError)
~~~

deviseでエラーが発生しました。

deviseをアップデートする

devise-3.3.0 はRails 4.2 では動かないようなので(https://github.com/plataformatec/devise/pull/3153)、deviseをアップデートします。

Gemfile

gem 'devise', '~> 3.5', '>= 3.5.2'
$ bundle update devise