Hey guys, I need your help again!
I have a form in which I want to nest multiple models. Kind of like "a
project has many tasks" but rather "a flight has one flight time per
So it's three models - Flight, FlightType and FlightTime. Flight ->
FlightTime <- FlightType
What I want to do is to loop through the FlightTypes in the add/edit
Flight form, and present a text box whose value then will be stored
as :hours in a FlightTime along with a :flight_id and :flight_type_id
value. I hope I've made myself clear.
This is the code I have in my flight_form view currently:
Now this works perfectly when _adding_ FlightTimes as I'm using a
FlightTime.new, but the issue I have is that I also want to be able to
edit the values. When I try to use this form for editing, all the
values in the boxes are emptied and anything I put in them are added
as new FlightTimes (obviously). There can only be one FlightTime per
FlightType per Flight, so to speak.
So, anyone up for the task to help me out?