Jack W Jennings
2007-Aug-02 19:24 UTC
Reading and saving data with belongs_to and has_many
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... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---