2

I'm trying to get user authentication with devise working, and failing.

I tried following the steps in the RailsGirls article, but after creating the simple new project, adding the gem 'devise' and running bundle install, but when I run rails generate devise:install I get a screenful of errors starting

Error:Get available generators script executes with errors:
Error:C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.1.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `devise' for User (call 'User.connection' to establish a connection):Class (NoMethodError)

Has anybody any idea what I might be doing wrong? (I tried using the instructions in the devise wiki, but I couldn't get it working that way either).

digitig
  • 1,989
  • 3
  • 25
  • 45

1 Answers1

1

I just ran to this same problem today, it's because you tried to generate the model before you tried to install devise it self

Stash ( or remove ) the changes for the user model and any migration file, then run this

rails generate devise:install

after that unstash and apply the migration, it should work just fine.

Mohammad AbuShady
  • 40,884
  • 11
  • 78
  • 89