user1136342
user1136342

Reputation: 4941

works locally but gives "uninitialized constant User (NameError)" on Heroku

I'm using Rails and MongoDB and Mongoid on Heroku. I'm using Devise for user authentication. User is supposed to be the name of the model that Devise created. When I run it locally, it's fine but on Heroku, the app crashes and has the following error in the logs.

/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in `block in constantize': uninitialized constant User (NameError)

Upvotes: 2

Views: 1214

Answers (1)

Deej
Deej

Reputation: 5352

I believe your problem is that your model user is most probably app/model/User.rb rename the file so that it is user.rb. Also make sure inside your user model you have

class User 
...... 
 ....
  ...

end 

Also make sure you run heroku rake db:migrate

Upvotes: 1

Related Questions