I see. Do the association_proxy extensions do what I was asking about? I've
changed for now to the _dataset method, I guess it's better to be explicit
in such cases.
Many thx.
terça-feira, 17 de Maio de 2016 às 19:37:06 UTC+2, Jeremy Evans escreveu:
>
> On Tuesday, May 17, 2016 at 8:45:23 AM UTC-7, Tiago Cardoso wrote:
>>
>> Hi,
>>
>> in my process of rewriting AR models to Sequel, I found that, although I
>> can replace scope/named_scope with subset calls on the class. However, I
>> seem not to be able to reuse them from the associations.
>>
>> class Wheel
>> many_to_one :car
>>
>> subset :full do
>> air > 0
>> end
>> end
>>
>> ...
>>
>> Wheel.full.all (this works)
>> Car.first.wheels.full (this does not work)
>>
>> How to do this?
>>
>
> Association methods return arrays by default, not proxy objects. You can
> do either:
>
> Car.first.wheels_dataset.full # returns dataset
>
> or
>
> Car.first.wheels{|ds| ds.full} # returns array
>
> 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 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.