Reputation: 899
I have a rails application using devise for authentication. It works when deployed locally but when push to Heroku I get this error
2014-07-03T14:20:17.235816+00:00 app[web.1]: /app/app/controllers/users_controller.rb:1:in `<top (required)>': uninitialized constant Users (NameError)
Here is the file it is referring to
class Users::SessionsController < Devise::SessionsController
before_create :create_associated_records
ROLES = [ROLE_STUDENT = 'student', ROLE_GRADUATE = 'graduate',
ROLE_INSTITUTIONAL_ADMIN = 'role_recruiter', ROLE_ADMIN = 'admin']
def create
@user = User.create(user_params)
end
private
def user_params
params.require(:user).permit(:avatar)
end
end
Thank you.
Upvotes: 0
Views: 610
Reputation: 3829
I believe you should either move
/app/app/controllers/users_controller.rb
to
/app/app/controllers/users/users_controller.rb
or change
class Users::SessionsController < Devise::SessionsController
to
class SessionsController < Devise::SessionsController
This is due to the ::
, which denotes a location. Users::SessionsController
would be looking for ./Users/SessionController
, which is a relative path to the current tree level (controllers
).
Upvotes: 2