Model.reset_column_information does not reload columns in rails migration

后端 未结 2 1994
长情又很酷
长情又很酷 2020-12-13 04:05

I\'m using Rails 3.2 and have a migration that contains the code:

add_column :users, :gift_aid, :integer, :default => 2
# reset columns
User.reset_column_         


        
2条回答
  •  攒了一身酷
    2020-12-13 04:25

    I think this must be some kind of bug related to schema caching... this might work:

    User.connection.schema_cache.clear!
    User.reset_column_information
    

    (for Rails 3.2.2)

提交回复
热议问题