catalog display is really just a glorified product listing.
every time a request comes in, we can recover the identity from the session and use it to find the cart in the database
dependent: :destroy -> indicates that the existence of line items is dependent on the existence of the cart
if a table has foreign keys, the corresponding model should have a belongs_to for each.
the default HTTP method for a link is a get, the default HTTP method for a button is a post.
@cart.line_items.build -> this causes a new line item relationship to be built between the @cart object and the product. You can build the relationship from either end.
Rails matches on is add_XXX_to_TABLE and remove_XXX_from_TABLE where the value XXX is ignored; what matters is the list of the column names and the types that appear after the migration name.
link_to_unless_current
if @person is just an empty object structure, form_form will work on the assumption that this is to create a new object. If @person actually contains data, however, form_for will assume that its form is editing that object and create a different looking form element, a hidden field to enable Rails’ REST capabilities.
helpers are simply modules containing methods that assist a view.
link_to and link_to_if take a condition parameter
a flash is a bucket (actually closer to a hash) in which you can store stuff as you process a request.
you can pass parameters to a partial, so that the partial can render different results.