Rails devise error "NoMethodError ... merge"

I was trying to make a User model with devise (so far in my application I have not had a problem with making Models or adding attributes). I run

rails g devise user

Which creates this:

  invoke  active_record
  create    db/migrate/20140930235224_devise_create_users.rb
  create    app/models/user.rb
  invoke    test_unit
  create      test/models/user_test.rb
  create      test/fixtures/users.yml
  insert    app/models/user.rb
  route  devise_for :users

Then I try to run

rake db:migrate

Which gives me the following

rake aborted!
NoMethodError: undefined method `merge!' for #<ActionDispatch::Routing::Mapper::Scope:0x9fc73a4>
/home/user/Desktop/MyApp/config/routes.rb:2:in `block in <top (required)>'
/home/user/Desktop/MyApp/config/routes.rb:1:in `<top (required)>'
/home/user/Desktop/MyApp/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

What could be the problem?

Line 2 for routes is:

devise_for :users

And line 5 for environment is:



It looks like this may be a problem with Devise and the latest version of Rails. Have a look at these issues on Devise Github:

This blog post explains that there is a branch with the fix, however, if you are going to be using this in production you should probably wait until Devise merge the fix into master.

Check what devise version you have installed by running:

bundle show devise

With the latest version of Rails 4.2.0, devise will need to be upgraded to 3.4.0 or higher. To do so, specify in your Gemfile:

gem 'devise', '~> 3.4.0'

Then run:

bundle update devise

Updating the version of devise from 3.3.0 to 3.4.0 in my Gemfile and running bundle update devise worked like magic for me. Im running rails 4.2.0.

Need Your Help

Compile to a stand-alone executable (.exe) in Visual Studio

c# c++ visual-studio executable console-application

how can I make a stand-alone exe in Visual Studio. Its just a simple Console application that I think users would not like to install a tiny Console application. I compiled a simple cpp file using ...

IIS application using application pool identity loses primary token?

asp.net active-directory iis-7.5 adsi applicationpoolidentity

(This is a question about a vague problem. I try to present all relevant data, in the hope that someone has helpful information; apologies for the long description.)