That worked:

  many_to_many :contacts,
    :class => Contact, :join_table => :users_favorites, 
    :left_key => :user_id, :right_key => :favorite_id,
    conditions: {Sequel[:users_favorites][:kind]=>'contact'}

Another issue:

> u = User[1]
#<User @values={:id=>1, ...>


> c = Contact[1]
#<Contact @values={:id=>1, ...>


> u.add_contact(c)
 #<Contact @values={:id=>, ...>

The :kind column in the users_favorites table doesn't get set.  Do I need a 
callback to set this on update?  I think I also need something similar for 
delete_contact for the same reason.


On Tuesday, November 13, 2018 at 4:01:35 PM UTC-6, Jeremy Evans wrote:
>
> Sequel[:user_favorites][:kind] is probably the easiest. There are other 
> ways if that doesn't work.

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

Reply via email to