> The solution provided by Rails is to use "rake db:setup" for fresh
> databases, but what if you need to run several migrations because you
> already have a database, but the code has changed in such a way that some of
> the earlier migration code won't run anymore?
This is off-topic.
You need to define the code you relay on in the migration file
class PostsToDasherize
table_name :posts
def dasherize!
title.dasherize!
title_will_change!
save!
end
end
class DasherizePosts < ActiveRecord::Migration
def self.up
ActiveRecord::Base.transaction do
PostsToDasherize.all.each{|p| p.dasherize! } # Use batches instead
end
end
def self.down
# ...
end
end
Robert Pankowecki
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.