Made a new API in rails 5 using default --api tag and installed devise_token_auth gem using command
rails generate devise_token_auth:install User auth
. On doing rake:db:migrate
, I get this error undefined method 'devise' for User (call 'User.connection' to establish a connection)
which is weird because devise_token_auth is built on top of devise..
So, commenting out routes throws error to user.rb file containing
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,:omniauthable
include DeviseTokenAuth::Concerns::User
After commenting those lines out it throws error to application controller containing:
include DeviseTokenAuth::Concerns::SetUserByToken
After commenting out this line, I get the devise:orm error.
Also tried adding devise to gemfile and installing devise for users, which failed too, throwing this error again undefined method 'devise' for User (call 'User.connection' to establish a connection)
Expected Migrations to go through,
Getting Devise errors
What should be done to resolve this?
PS- This was a third API I'm making using Devise_token_auth gem, didn't face this issue earlier
NoMethodError: undefined method
devise' for User (call 'User.connection' to establish a connection):Class` – Captor