Probably an :adder and :remover?

I can't pass the intersection table, however:

    adder: (
      lambda do |users_favorites|
        users_favorites.update(users_favorites: id, type: 'contact')
      end
    )


Maybe there's a better way?

On Wednesday, November 14, 2018 at 8:37:54 AM UTC-6, craig buchanan wrote:
>
> 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 [email protected].
To post to this group, send email to [email protected].
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