`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.
This is the appropriate Order.
gem 'devise'
Run the bundle command to install it.
rails generate devise:install
rails generate devise MODEL
Here Model was created before the "rails generate devise:install".So you have to go back an comment everything that model created :
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
#devise :database_authenticatable, :registerable,
#:recoverable, :rememberable, :trackable, :validatable
end
and also this
Rails.application.routes.draw do
#devise_for :users
end
Now,Run "rails generate devise:install" and after that uncomment the above .
I ran into a similar problem with an existing project freshly checked out from a repo:
The specific missing files were:
config/initializers/devise.rb
config/locales/devise.en.yml
In this case, because the devise.rb
was in the .gitignore
list there was a config/initializers/devise.rb.example
file that could be copied over.