Rake db:迁移未初始化的常量
为了运行 rake db:migrate 我需要在应用程序控制器中定义模型和常量。
当我运行它时,我得到这个
rake aborted!
An error has occurred, all later migrations canceled:
uninitialized constant Secondsperday
我需要的只是 rake 来加载环境。它曾经这样做过...
Secondsperday is not a model, its this line in application controller.rb
Secondsperday = 24 * 3_600
请帮忙,我已经被困了一个星期了。
In order to run rake db:migrate I need both my models and constants defined in application controller.
When I run it I get this
rake aborted!
An error has occurred, all later migrations canceled:
uninitialized constant Secondsperday
All I need is rake to load the environment. It used to do this...
Secondsperday is not a model, its this line in application controller.rb
Secondsperday = 24 * 3_600
Please help, I've been stuck for a week.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
迁移不会加载应用程序控制器。
如果您想要应用程序范围的常量,请在 $RAILS_ROOT/config/initializers 中的文件中定义它们
Migrations don't load application controller.
If you want application-wide constants define them in a file placed in $RAILS_ROOT/config/initializers