Skip to content

Instantly share code, notes, and snippets.

@johnbeynon
Created October 4, 2010 17:33
Show Gist options
  • Save johnbeynon/610112 to your computer and use it in GitHub Desktop.
Save johnbeynon/610112 to your computer and use it in GitHub Desktop.
class PurgePostCategories < ActiveRecord::Migration
@posts = [3,6,9,10,11,14,15,19,23,24,38,40,42,65,66,70,71,103,106,107,108,109,197,198,199,200,201]
c = Category.find_by_title('Useful')
def self.up
@posts.each do |post|
Post.find(post).categories.delete(c)
end
end
def self.down
@posts.each do |post|
Post.find(post).categories << c
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment