For example I have the following migration
class AddStatusField < ActiveRecord::Migration
def self.up
add_column :tasks, :status, :string
Task.update_all "status='complete'", "completed = 't'"
remove_column :tasks, :completed
end
end
When I run this (using rake db:migrate
) I get the following message
== AddStatusField: migrating =================================================
-- add_column(:tasks, :status, :string)
-> 0.0010s
-- update_all("status='complete'", "completed = 't'")
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `update_all' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0xd3d34a8>
If I immediately run the migration it again the update_all
calls appear to work.
I'm using Rails 2.3.5 and sqlite3.
What gives?