Reputation: 231
I have an rails 3 (3.0.9) application working on ruby 1.8.7 with the gem devise (1.4.2) on my computer working perfectly.
I tried to push it on heroku and i got the following error message on application load:
[WARNING] You provided devise_for :users but there is no model User defined in your application
=> Booting WEBrick
=> Rails 3.0.9 application starting in production on http://0.0.0.0:43292
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/inflector/methods.rb:124:in `block in constantize': uninitialized constant User (NameError)
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/inflector/methods.rb:123:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/inflector/methods.rb:123:in `constantize'
from /app/vendor/bundle/ruby/1.9.1/gems/devise-1.4.2/lib/devise/mapping.rb:84:in `to'
from /app/vendor/bundle/ruby/1.9.1/gems/devise-1.4.2/lib/devise/mapping.rb:79:in `modules'
from /app/vendor/bundle/ruby/1.9.1/gems/devise-1.4.2/lib/devise/mapping.rb:88:in `strategies'
from /app/vendor/bundle/ruby/1.9.1/gems/devise-1.4.2/lib/devise.rb:410:in `block in configure_warden!'
from /app/vendor/bundle/ruby/1.9.1/gems/devise-1.4.2/lib/devise.rb:409:in `each_value'
from /app/vendor/bundle/ruby/1.9.1/gems/devise-1.4.2/lib/devise.rb:409:in `configure_warden!'
The problem comes from devise but i don't know how to fix it. My model User is correctly defined, and it works on my computer... Does anyone know how to fix this ?
Thanks for you help
Upvotes: 1
Views: 1663
Reputation: 1074
Check inside your users.rb to make sure that you spelled ':database_authenticable' correctly, this seems to be a common problem with this error.
class User < ActiveRecord::Base
devise :database_authenticable, :recoverable,
:rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
end
Also, I suggest you take a look here, to see how these people fixed the error. http://groups.google.com/group/plataformatec-devise/browse_thread/thread/807f4c6e3475622f
Upvotes: 1
Reputation: 42865
Make sure you have this:
class User < ActiveRecord::Base
Defined at the top of your user/devise model.
ALso, make sure you run your migrations.
heroku rake db:migrate
In console.
Upvotes: 2