Undefined Method 'Devise' for User

undefined method 'devise' for User

Add devise to your application Gemfile and install it by running bundle install. After this, you should run the following generator command:

rails generate devise:install

This generator will install an initializer your_application/config/initializers/devise.rb which consists of all the Devise's configuration options.

You missed the above mentioned step which is why the devise configurations are not set and you receive undefined method 'devise' for User error in your model class User.

`method_missing': undefined method `devise' for User (call 'User.connection' to establish a connection)

This happens because you missed the command:

rails generate devise:install

You need just comment all devise lines temporally (in routes.rb / user.rb) to not get raise.

And run command again.

NoMethodError: undefined method `devise' for Admin

You've forgotten to run the generator command:

rails generate devise:install

This will load all of Devises configuration options.



Related Topics



Leave a reply



Submit