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
Ruby: Most Concise Way to Use an Env Variable If It Exists, Otherwise Use Default Value
Is Require File.Expand_Path(..., _File_) the Best Practice
Disable a Group of Tests in Rspec
Rails Mapping Array of Hashes Onto Single Hash
Finding What Is Common to Two Arrays
How to Get the Number of Days in a Given Month in Ruby, Accounting for Year
If Java People Go to Scala, C# Go to F#, Where Do Ruby People Go for Functional Nirvana
Generating Unique, Hard-To-Guess "Coupon" Codes
How to Remove Carriage Returns with Ruby
When Do We Use the "||=" Operator in Rails? What Is Its Significance
Rails 4.0.1 on Heroku, Can't Create Database
Getting Ruby 1.8.7 Installed on Mountain Lion (10.8)
Error Installing Gems That Use Native Extensions on Ubuntu, Ruby 1.9.2 via Rvm