I am cheap and in an attempt to learn about rails & relationships I'm
trying to create an application that my friends and I can use as a way
to split the cost of items we buy @ Costco.

Right now the models i have are:

User - Various people involved
Run - Represents Costco runs
Item - Individual items purchased during a Costco run


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


Run.rb
# A run is an individual trip to costco.  On a run many items are
purchased.
has_many :items


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



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 ;)
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to