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).
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.