我推送到Heroku并运行rake db:migrate
后,我的应用程序崩溃了。但错误没有意义......
ActionView::Template::Error (undefined method `email_address' for #<Invite:0x000000065fb788>):
...因为迁移包含:
rename_column :invites, :email, :email_address
所以我最终发现它在应用程序重启(heroku restart
)后起作用了。很划算。
但是,我对rake db:migrate
现在如何运作感到困惑。每次其他迁移都会在没有重新启动的情况下获取相应的模型属性。
当我在Heroku上运行rake db:migrate
时会发生什么? 是什么促使应用程序获取新模型属性,为什么这次不起作用?
答案 0 :(得分:0)
在新的rails应用程序中,您可以看到以下内容
... /配置/环境/ development.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
... /配置/环境/ production.rb
# Code is not reloaded between requests
config.cache_classes = true