To remember:
- Rails will change plurals when generating models
- Do not use convention words for other stuff, you will just confuse yourself!
New:
- Use block to have closing tags
- Form helper: adds more stuff, including the authenticity token
- label_tag: first argument = for and second argument=content
- for inputs, each type has a different tag. First argument = name (and id), 2nd argument = value (prepopulate), 3rd hash = attributes of the element (for example to change id to a non conventional name)
- HTML default behavior is "gets", but Rails is "post"
-
find_by
: same aswhere
but gives the first instance directly. Alsofind
method is the same but use directly a number (for id). If the id does not exist, first method givesnil
, butfind
gives an exception (ActiveRecord not found = 404 error in production) -
resources :movies
= gives all 7 routes - Default behavior can always be overwrite
- Using conventions makes everything EASIER!
Top comments (0)