本地的新属性,登台时未定义

时间:2014-06-13 18:07:26

标签: ruby-on-rails heroku migration

我在我的Tags表中添加了一个新的属性列,在本地它运行正常。 但是在heroku中,即使我已经完成了heroku run rake db:migrate并且创建了新列,但在创建新标记时它会给我一个错误。

ActionView::Template::Error (undefined method `price_type' for #<Tag:0x007fc3180e9448>):

为什么这会在升级而非开发中发生?

编辑:

迁移文件

class AddPriceTypetoTags < ActiveRecord::Migration
  def change
    add_column :tags, :price_type, :integer
    add_column :tags, :max_price, :integer
    rename_column :tags, :price, :min_price
  end
end

我的heroku记录

heroku run rake db:migrate --remote staging
Running `rake db:migrate` attached to terminal... up, run.7489
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Migrating to AddPriceTypetoTags (20140611231324)
==  AddPriceTypetoTags: migrating =============================================
-- add_column(:tags, :price_type, :integer)
   -> 0.0103s
-- add_column(:tags, :max_price, :integer)
   -> 0.0013s
-- rename_column(:tags, :price, :min_price)
   -> 0.0064s
==  AddPriceTypetoTags: migrated (0.0188s) ====================================

0 个答案:

没有答案