On Feb 12, 3:11 pm, Josh Traxton <[email protected]> wrote: [...] > I was hoping that someone could point me in the right direction as to > how i setup up the relationships... > > These are my models: > > Item.rb > # An item is purchased on a run and it's cost can be split between many > Users. Because many Users can split the cost of an Item, it is owned by > 1 or more Users. > belongs_to :run > belongs_to :user
This looks fine. > > Run.rb > # A run is an individual trip to costco. On a run many items are > purchased. > has_many :items So does this. At some point, you might also need has_many :users; it depends on what you're doing. > > User.rb > # A User can participate in many runs and during the run will be buying > Items (or maybe buying a fraction of 1 item). > has_many :runs > has_many :items, :through => :participations #This is my area of > question Why do you need a :through at all here? has_many :items should be sufficient, if I understand the situation correctly. > > I realize this is incorrect as is, but could someone shed some light on > how i should be thinking about a situation like this? > > Thanks for your time and for reading a big post like this ;) You're welcome! Best, -- Marnen Laibow-Koser [email protected] http://www.marnen.org --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

