I am encountering a weird problem.  Object associations don't appear to be 
getting loaded onto various objects when marshaled into entities from the 
db.

I have eager loading turned on for a particular model, which is also using 
the rcte_tree plugin.

These errors don't seem to happen when eager loading is turned off.
These errors also seem to go away when I make a naive little patch to the 
appropriate source files.  See below.

Locations of apparent originations of problems are approximately in the 
following spots.

associations.rb:
1113: def_many_to_many
1167:   object.associations[name].push(assoc_record)}

1273: def_one_to_many
1328:   object.associations[name].push(assoc_record)

plugins/rcte_tree.rb:
95:   apply
209:    root.associations[ancestors] << obj

316:    root.associations[descendants] << obj


My very naive patches to these files involve adding more or less this line 
immediately preceding the above:

object.associations[name] ||= []


The full stack trace looks more or less like this:

undefined method `<<' for nil:NilClass
/usr/local/lib/ruby/gems/shared/gems/sequel-3.39.0/lib/sequel/plugins/rcte_tree.rb:316:in
 
`apply'
/usr/local/lib/ruby/gems/shared/gems/sequel-3.39.0/lib/sequel/dataset/actions.rb:57:in
 
`all'
/usr/local/lib/ruby/gems/shared/gems/sequel-3.39.0/lib/sequel/plugins/rcte_tree.rb:296:in
 
`apply'
/usr/local/lib/ruby/gems/shared/gems/sequel-3.39.0/lib/sequel/model/associations.rb:2081:in
 
`eager_load'
/usr/local/lib/ruby/gems/shared/gems/sequel-3.39.0/lib/sequel/model/associations.rb:2044:in
 
`eager_load'
/usr/local/lib/ruby/gems/shared/gems/sequel-3.39.0/lib/sequel/plugins/tactical_eager_loading.rb:47:in
 
`load_associated_objects'
/usr/local/lib/ruby/gems/shared/gems/sequel-3.39.0/lib/sequel/model/associations.rb:1109:in
 
`descendants'


-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/e08MP56-KfoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to