Forum: Ruby on Rails Reading and saving data with belongs_to and has_many

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5f6208fd7507f407f01d97f8420fa1d4?d=identicon&s=25 Jack W Jennings (Guest)
on 2007-08-02 21:25
(Received via mailing list)
Hi all, I'm new to Ruby on Rails, and so I have a question that's
probably simple, but I can't figure it out.

I'm trying to create several models that all belong_to a master model,
say "entries", which has_one of the others. The other tables
("destinations", "people", "entrydates") all have the entry_id row.

How would one reference each row that matches the entry.id in a loop
(i.e. display the entry and the "destination", "person", and
"entrydate" that matches)?

Also, how would one save the data to each of these tables in one
form?

All of the code that I've written has been lengthy and ugly (and also
doesn't really work), and I can only imagine that there has to be a
concise way to do this...
This topic is locked and can not be replied to.