Posted over 5 years ago. Visible to the public.

Nested forms [2d]


  • Understand how nested attributes appear in the params.
  • See how the Rails form helpers encode the names of nested inputs.
  • Understand how the record and all of its nested attributes are saved in a transaction. That means the entire structure is saved or not.


Exercise: Showtimes for MovieDB

  • A movie has a list of showtimes. Each showtime consists of the name of the cinema, and the start time (both can be simple text fields).
  • Expand the movie form with a simple interface that allows adding, editing and removing of showtimes. It is fine when you can only add 5 showtimes at a time.
  • Showtimes should validate the presence of cinema and date.
  • Also add a field total_showtimes that caches the number of total showtimes. Do not use Rails' counter cache mechanism.
  • When you delete a showtime, does total_showtimes decrease as expected?

Owner of this card:

Henning Koch
Last edit:
over 1 year ago
by Johanna Hartmann
Posted by Henning Koch to makandra Curriculum
This website uses short-lived cookies to improve usability.
Accept or learn more