Skip to content

Instantly share code, notes, and snippets.

@armandofox
Created February 16, 2016 01:12
Show Gist options
  • Save armandofox/232339c79f85b2656e3b to your computer and use it in GitHub Desktop.
Save armandofox/232339c79f85b2656e3b to your computer and use it in GitHub Desktop.
associations_migration.rb
# Run 'rails generate migration create_reviews' and then
# edit db/migrate/*_create_reviews.rb to look like this:
class CreateReviews < ActiveRecord::Migration
def up
create_table 'reviews' do |t|
t.integer 'potatoes'
t.text 'comments'
t.references 'moviegoer'
t.references 'movie'
end
end
def down ; drop_table 'reviews' ; end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment