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.
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.
>
undefined method `id' for {:count=>10}:Hash
org/jruby/RubyBasicObject.java:1703:in `__send__'
org/jruby/RubyKernel.java:2209:in `send'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2152:in
`eager_load'
org/jruby/RubyArray.java:1617:in `each'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2145:in
`eager_load'
org/jruby/RubyArray.java:1617:in `each'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2136:in
`eager_load'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2232:in
`post_load'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/tactical_eager_loading.rb:66:in
`post_load'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:47:in
`all'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/eager_each.rb:41:in
`all'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/eager_each.rb:39:in
`all'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/eager_each.rb:29:in
`each'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:585:in
`single_record'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:593:in
`single_value'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:250:in
`get'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:107:in
`count'
... /artist.rb:155:in `remove'
and,
undefined method `id' for {:one=>1}:Hash
org/jruby/RubyBasicObject.java:1703:in `__send__'
org/jruby/RubyKernel.java:2209:in `send'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2152:in
`eager_load'
org/jruby/RubyArray.java:1617:in `each'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2145:in
`eager_load'
org/jruby/RubyArray.java:1617:in `each'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2136:in
`eager_load'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:2232:in
`post_load'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/tactical_eager_loading.rb:66:in
`post_load'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:47:in
`all'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/eager_each.rb:41:in
`all'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/eager_each.rb:39:in
`all'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/plugins/eager_each.rb:29:in
`each'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:585:in
`single_record'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:593:in
`single_value'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:250:in
`get'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/dataset/actions.rb:153:in
`empty?'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1696:in
`remove_associated_object'
/usr/java/jruby-1.7.4/lib/ruby/gems/shared/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1476:in
`remove_child'
... /artist.rb:158:in `remove'
Cheers,
-Nels
--
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.