undefined method `devise_for' in rails

前端 未结 4 1758
天命终不由人
天命终不由人 2021-01-31 01:24

After I install devise and create a user model. I rake db:migrate and then I rake routes. I then get a error with \"undefined method `devise_for\' for

4条回答
  •  情深已故
    2021-01-31 01:46

    If you have the Devise gem specified in the Gemfile, just make sure you have the following in your routes.rb file:

     devise_for :users
    

    Also, here's a trick to make sure Devise is mapped properly, run: rails c, (the Rails app console) in your app's folder and then the following command line:

     Devise.mappings.keys
    

    You should see:

    => [:user] 
    

    Cheers!

提交回复
热议问题