Created
March 17, 2017 16:14
-
-
Save wichopy/948547aed05d6191f367631abc0959dc to your computer and use it in GitHub Desktop.
Create new model, migration and manually insert data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command to insert: | |
r = Rating.create :user_id => 1, :product_id => 1, :description => 'I dont like this shirt', :rating => 2 | |
To run migration: | |
bin/rake db:migrate | |
To create anew migration for adding in reference columns : | |
bin/rails generate migration AddUserAndProductToRatings user:references product:references | |
Create a new model/migration | |
bin/rails generate model Rating description:text rating:integer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment