Skip to content

Instantly share code, notes, and snippets.

@danielnmai
Last active May 12, 2017 04:11
Show Gist options
  • Save danielnmai/c2a1dee98587cbc7d5d7626e8ce607e6 to your computer and use it in GitHub Desktop.
Save danielnmai/c2a1dee98587cbc7d5d7626e8ce607e6 to your computer and use it in GitHub Desktop.
Today I Learned - Bootcamp

------ Day 2 -------

The rails' "button_to" can add a button to the html file instead of using the tag. The rails' "link_to" method can be used to conveniently add a link to html file.

------ Day 3 ------- We can use redirect_to to navigate to a page after a form is submitted.

flash: a built-in Rails method (put in in layouts/application.html.erb) to pass information in one page to another.

Remember: For bootstrap's dismissable alerts to work, we need to update our Rails gems if we use Rails 5.1.0 or later. Use Command + Shift + V to "nicely" paste codes with auto-corrected indentation. TWBSColor: used to customize nav-bar

------ Day 4 ------- In Rails, an integer data type can only be 4-digit long.

You want to keep your Model class fat and your controller small.

db:drop => delete the whole database db:seed => use to add more information to our database

------ Day 5 -------

In ruby, everything is true, except nil and false (boolean value). && only moves forward in condition(s) if the previous condition is true. || onlue moves forward in condition(s) if the previous condition is false.

condition moves left to right nil && 77 || "ghost" => false because (nil && 77 is false, and Ruby ignores the rest of the condition)

No double quotation marks "" in SQL commands!!!

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