HABTM Polymorphic Relationship
问题 I'm pretty new to Rails, and i'm trying to do a polymorphic HABTM relationship. The problem is that I have three models that I want to relate. The first one is the Event model and then are two kind of attendees: Users and Contacts. What I want to do is to be able to relate as an attendee both users and contacts. So, what i have right now in my code is: Event Model has_and_belongs_to_many :attendees, :polymorphic => true User Model has_and_belongs_to_many :events, :as => :attendees Contact