day 103 — code 365
Thu 24 Mar 2016
WDI Week 5 (Day 24)
Things we did today:
- Rails: Users — signup, signing, authentication
- Rails: Associations — has_many_and_belongs_to_many
Command + Shift + Return
Insert line above, and place cursor there.
Some notes I wrote about the yield and views in Rails:
Rails will yield to an .html.erb (ie. a view; all .html.erb files are views) when there is a GET request to that route (URL).
Will result in Rails looking up this route:
And by default, it will be handled by this controller#action combination:
and it will yield to to index.html.erb
The particulars for this live inside the users controller, and inside the index action.
There are some actions that don’t control views.
This is because views are activated only by GET requests.
If there is a (for example) POST request to users/, then that will be managed by another action (the users#create, by default).
There must be a .html.erb for every GET request.
When there is a GET request to a particular route, the application layout will be rendered, then Rails will yield to the appropriate erb.
We are only using some (3) of the (4) default get views in the user CRUD system in the TUNR app.
The pages system only uses one view.
Now we start working on our next project! I’m going to make a web bookmark manager, and I’m going to draw out my models and associations between them — and hopefully get the associations between the tables done correctly…!
Thanks for stopping by!