Awesome, thanks for your help!
On Saturday, 26 October 2019 08:12:15 UTC+2, Jeremy Evans wrote:
>
> On Friday, October 25, 2019 at 3:29:03 PM UTC-7, Nícolas Iensen wrote:
>>
>> Thanks for your reply.
>>
>> Now considering the two models below:
>>
>> class Producer < Sequel::Model
>> one_to_many :films
>>
>> dataset_module do
>> def fooes
>> where{name = "foo"}
>> end
>> end
>> end
>>
>> class Film < Sequel::Model
>> many_to_one :producer
>> end
>>
>> Could I reuse the dataset fooes implemented in the Producer's module to
>> build the same SQL query?
>>
>
> Producer.from(:films, :producers).where{ { producers[:name] => 'foo',
> films[:producer_id] => producers[:id] } }.fooes.delete
>
> Note that your fooes method definition is not going to do what you want.
> You want:
>
> def fooes
> where(name: "foo")
> end
>
> or just:
>
> where :fooes, name: foo
>
> 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/b941bb01-4433-4e91-a7b4-6b3a16d938b4%40googlegroups.com.