Created
November 9, 2015 06:28
-
-
Save hankliu5/75f1ac52808ac5d25b58 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
TodoList.destroy_all | |
User.destroy_all | |
Profile.destroy_all | |
# Here we use exclamation because it will warn you if something goes wrong. | |
# The regular create won't tell you anything if fail. | |
Profile.create! [ | |
{ first_name: "Carly", last_name: "Fiorina", birth_year: 1954 }, | |
{ first_name: "Donald", last_name: "Trump", birth_year: 1946 }, | |
{ first_name: "Ben", last_name: "Carson", birth_year: 1951 }, | |
{ first_name: "Hillary", last_name: "Clinton", birth_year: 1947 } | |
] | |
Profile.find_by!(first_name: "Carly").create_user(username: "Fiorina", password_digest: 1954) | |
Profile.find_by!(first_name: "Donald").create_user(username: "Trump", password_digest: 1946) | |
Profile.find_by!(first_name: "Ben").create_user(username: "Carson", password_digest: 1951) | |
Profile.find_by!(first_name: "Hillary").create_user(username: "Clinton", password_digest: 1947) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment