On Tuesday, December 3, 2013 11:30:05 PM UTC-8, Nels Nelson wrote:
> On Wednesday, December 4, 2013 1:04:43 AM UTC-6, Jeremy Evans wrote:
>>
>> If you always want the foos loaded every time you load the Bar, you could
>> try:
>>
>> class Bar < Sequel::Model
>> many_to_many :foos, :after_load => proc{|bar, foo|
>> something_special_with(bar, foo)}
>> plugin :tactical_eager_loading
>> def after_initialize
>> foos
>> end
>> end
>>
>
> But foos wouldn't be getting loaded eagerly in this case? I'll give it a
> shot in conjunction with the eager loading defined on the Bar.children
> association re-defintion.
>
Assuming you use Dataset#all to return the Bar instances, foos will be
eagerly loaded (that's what the tactical_eager_loading plugin does).
>
>
> undefined method `id' for {:count=>10}:Hash
>>>
>>> undefined method `id' for {:one=>1}:Hash
>>>
>> Could you provide a full backtrace for these errors? This looks like the
>> type of error you would get if you were using eager_graph, but not eager.
>>
>
Both of these errors are due to the eager_each plugin. Either it should be
changed to not automatically use all for datasets without a row_proc, or
the default eager loading code should not eager load if there isn't a
row_proc. The second is a more general fix, so I'll probably do that.
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.