Victor
Victor

Reputation: 13388

Removed a column, Rails still wants to write on it

Recently I removed a column abc from one of my tables using rake db:migrate, 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.

Upvotes: 0

Views: 100

Answers (3)

Fábio Batista
Fábio Batista

Reputation: 25280

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

Upvotes: 2

Victor
Victor

Reputation: 13388

Got it working after reloading Apache. Is this actually the correct way?

Upvotes: 0

Anubhaw
Anubhaw

Reputation: 6068

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......

Upvotes: 0

Related Questions