Awesome, thanks!
On Friday, July 10, 2020 at 5:50:38 PM UTC+3, Jeremy Evans wrote:
>
> On Thursday, July 9, 2020 at 5:53:05 PM UTC-7, Aryk Grosz wrote:
>>
>> one_to_one :some_association,
>> class: "SomeAssociation",
>> graph_block: (proc do |j|
>> byebug
>> {Sequel[j][:user_id] => current_user.id}
>> end) do |ds|
>> byebug
>> ds.where(user_id: ds.model.current_user.id)
>> end
>>
>>
>>
>>
>> I was calling
>>
>> models = Model.all
>>
>> models.first.some_association
>>
>> I noticed that sometimes that second block (:block option) was not
>> getting triggered, but the sequel would run with conditions cached on
>> previous runs?
>>
>> Is there any kind of caching that might be happening with the resulting
>> conditions from the block passed into one_to_one?
>>
>> The current_user.id is being cached from previous calls and the block is
>> not getting run on a per call basis.
>>
>> Anyway to override that?
>>
>
> Sequel.delay{current_user.id}
>
> 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/a886c66f-3754-48f4-a330-f699fd475624o%40googlegroups.com.