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
.