I'm newer to Rails and have a problem with a model that has multiple relationships to another model. This is my current setup, and I can add events to the user through the UserEvents model. However, obviously I can't have the relationship called events twice...and this is where I am stumped.
class User < ActiveRecord::Base
has_many :user_events
has_many :events, :through => :user_events
has_many :events, :through => :user_participating
end
class UserEvents < ActiveRecord::Base
belongs_to :event
belongs_to :user
end
class UserParticipating < ActiveRecord::Base
belongs_to :event
belongs_to :user
end
class Events < ActiveRecord::Base
has_one :user_event
has_one :user, :through => :user_events
has_many :user_participating
has_many :user, :through => :user_participating
end
There is definitely a good chance I am going about this all wrong, however, I have been at it for several hours and I don't seem to be getting anywhere. So, I figured I would ask. Thanks!