Heroku [警告]您提供了devise_for:用户,但在您的应用程序中没有定义用户定义的模型 [英] Heroku [WARNING] You provided devise_for :users but there is no model User defined in your application
问题描述
我有一台Rails 3(3.0.9)应用程序,可以在我的电脑上完美运行Ruby 1.9.7和gem devise(1.4.2)。
我试图在heroku上推送它,并在应用程序加载时收到以下错误消息:
[警告]您提供了devise_for:users但没有模型用户在您的应用程序中定义
=>引导WEBrick
=> Rails 3.0.9应用程序在http://0.0.0.0:43292
=>上生产时开始生产。用-d呼叫以分离
=> Ctrl-C关闭服务器
退出
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/inflector/methods.rb:124:in` block in constantize':未初始化的常量User(NameError)
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/inflector/methods.rb:123:in来自/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/inflector/methods.rb:123:in`constantize'
的每个'
' /app/vendor/bundle/ruby/1.9.1/gems/devise-1.4.2/lib/devise/mapping.rb:84:in`从/app/vendor/bundle/ruby/1.9到'
' .1 / gems / devise-1.4.2 / lib / devise / mapping.rb:79:在`modules'中
来自/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!'
问题来自设计,但我不知道如何解决它。
我的模型用户被正确定义,并且它可以在我的电脑上运行...
有人知道如何解决这个问题吗?
感谢你帮助
请确保您有这个:
class User< ActiveRecord :: Base
定义在用户/设计模型的顶部。
此外,请确保您运行迁移。
heroku rake db:migrate
在控制台中。
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
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.
这篇关于Heroku [警告]您提供了devise_for:用户,但在您的应用程序中没有定义用户定义的模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!