Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acuppy/4eb4fe721ae86bf31a501a4bd9850e8f to your computer and use it in GitHub Desktop.
Save acuppy/4eb4fe721ae86bf31a501a4bd9850e8f to your computer and use it in GitHub Desktop.
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