mass assignment and the .build(params[:user_name])
Layouts and Sub-layouts
On the Index Page
<% content_for :sub_navdo%> <%= link_to "New Song", new_song_path %><% end %> # this could also be on the show page so they would share this sub_nav <nav class="sub_nav"><%=yield:sub_nav%> <% end %># this works because you create another yield in the app besides the body
you can open up a sublayout as many times as you want to add links…
polymorphic interfaces: depending on the argument that you send it, it has different behavior
when you send @mixtape it looks up:
real life e.g.s
subway slot can accept a metrocard and a credit card– depending on what you send it, it has differnt behavior
a vending machine accepts dollar bills and credit card. Depending on what you insert, it has different behavior.
render is another flexible polymorphic object-
Rending Partials in a Collection- very important
<%= render @mixtape.songs %>#Down a level of abstraction since it reveals the collection and partial:<%=render:collection=>@mixtape.songs,:partial=>songs/song_li',:as=>:song%>
<%= render 'songs/fields', :f =>song_form%>
If skip album name is true, then
<% if include_album_name%> <div class="field"><% f.label :album%> <br />#more code....