Hi again! In my application, I have a Users model and an Events model. I
also have a link model to link an event to a user. However, a user can
be linked to an event in a number of ways - e.g. they can have created
an event, or subscibed to an event.
Now, the link table for both these relationships will effectively
contain the same information - an event ID and a user ID.
How is this link represented in the rails model?
For example, can I say:
class User < ActiveRecord::Base
has_many :created_events
has_many :subscribed_events
has_many :events, :through => :created_events, :subscribed_events
or something to that effect? Also, how would User.events work in this
case? The logic doesn’t seem quite correct!
Have I went about my database design in the wrong way?
As always, any help is greatly appreciated - I hope I have made myself
clear!
Cheers,
Mick