Go it. Thank you. Not just for your response, but also for Sequel and Roda. 
;-)

On Monday, July 22, 2019 at 12:35:04 AM UTC+1, Jeremy Evans wrote:
>
> On Sunday, July 21, 2019 at 3:41:54 PM UTC-7, Matthew Gibbons wrote:
>>
>> Okay, so I have this:
>>
>>     class Team < Sequel::Model
>>       many_to_many :users
>>
>>       many_to_many(:admins, class: User, :join_table => :teams_users, 
>> :right_key => :user_id) do |ds|
>>         ds.where(Sequel[:teams_users][:role] => 'admin')
>>       end
>>     end
>>
>> Which give me :users and ;admins. #add_user works, however #add_admin 
>> does the same as #add_user - the where clause in the dataset is not 
>> respected.
>>
>
> add_admin would insert a record into the join table.  INSERT doesn't use a 
> WHERE clause, so that is expected.  If you want to set the :role entry in 
> add_admin, you want to use the :adder association option.
>
> Thanks,
> Jeremy 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/33bfe475-51de-48d1-a72a-2f7948399dea%40googlegroups.com.

Reply via email to