Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class AddCategoriesToPosts < ActiveRecord::Migration
# Fill the void
class ::Category < ActiveRecord::Base
end unless defined? ::Category
def change
Post.find_each do |p|
p.categories.create
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment