I would like to allow a User to mark a Contact or Entity as a favorite. Towards this end, I have these tables:
* users, contacts, entities * users_favorites: :id, :user_id, :favorite_id, :kind User model: many_to_many :contacts, :class => Contact, :join_table => :users_favorites, :left_key => :user_id, :right_key => :favorite_id, conditions: {:kind=>'contact'} many_to_many :entities, :class => Entity, :join_table => :users_favorites, :left_key => :user_id, :right_key => :favorite_id, conditions: {:kind=>'entity'} Contact model: many_to_many :users, :class => User, :join_table => :users_favorites, :left_key => :favorite_id, :right_key => :user_id, conditions: {:kind=>'contact'} Entity model: many_to_many :entities, :class => Entity, :join_table => :users_favorites, :left_key => :favorite_id, :right_key => :user_id, conditions: {:kind=>'entity'} When I attempt to lists a User's contacts, I get an error: IRB> User[1].contacts Sequel::DatabaseError: SQLite3::SQLException: ambiguous column name: kind Question: What's the correct way to specify the table name in the conditions? In general, would you recommend this approach? I'm sure it would be easier with a table for each kind (e.g. users_contacts, users_entities). -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.