Here is the setup:
I'm writing an application to model a house. Houses have rooms. I
need the room to have a name, an id, and then one or more lights. Each
light has wattage, hours_per_day, and quantity. I'd also like the room
to have many small_appliances, but I haven't gotten that far yet.
The best I've been able to figure out is to have a separate table for
Lights so that a room can have many lights. My setup is a Houses table
that has_many Rooms. I have a Rooms table that has_many Lights. I
have a page where you can add a Room to a House.
On this page there is a text_field for name, and 3 sets of text_fields
for the lights, since I can't figure out a way to allow the user to
dynamically add extra lights. The code snippet: