Skip to content

Instantly share code, notes, and snippets.

@danielnmai
Last active May 21, 2017 02:59
Show Gist options
  • Save danielnmai/9ede9aee4fa194fe263d44bf3ec996a7 to your computer and use it in GitHub Desktop.
Save danielnmai/9ede9aee4fa194fe263d44bf3ec996a7 to your computer and use it in GitHub Desktop.
Today I learned - Week4

-----5/14/2017----- It is better to use Recipe.where ("prep_time > ?", 10) than Recipe.where("prep_time > 10") because sometimes user does not enter 10 as prep_time, but some strings or something else. That's why we need to check user's input first. localhost:3000?sort=prep_time => sort the index page by prep_time (asc order) 85% of jobs applicants got jobs through referrals.

-----5/15/2017----- Normalization: reduce repeatative rows in Database associations. Foreign key: one-to-many relationships belongs_to has_many

-----5/16/2017----- rails db:reset: do 4 things: drop database create database add migration add db:seed -----5/17/2017----- many-to-many relationship in Rails: has_many :database_1, through: :join_database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment