Recently I removed a column abc
from one of my tables using rake db:migrate
, 开发者_StackOverflow中文版remove_column
on self.up
. The column has been successfully removed.
While I try to add an entry to the table, I have this error:
ActiveRecord::StatementInvalid (Mysql::Error: Unknown column 'abc' in 'field list':
INSERT INTO...
It was trying to write on that column, though it doesn't exist anymore. I have checked all my models and confirmed abc
doesn't exist anymore. Also checked schema.rb
and abc
has been removed.
When you change something like this on production, you must reload the application... If you are using Phusion Passenger, you do it by running:
touch tmp/restart.txt
Your code must be referring to 'abc' column where ever you are trying to add an entry to the table. You need to remove the reference as the column has been removed.
Thanks......
Got it working after reloading Apache. Is this actually the correct way?
精彩评论