[Backgroundrb-devel] BgDRb initializes my models twice?

Michael Siebert siebertm85 at googlemail.com
Wed Feb 27 08:11:39 EST 2008


Hello there,

I've stumbled into a phenomenon: my models get loaded twice (or more).  
Best thing would be describing my setup:

I have a Folder model using acts_as_taggable (from  
acts_as_taggable_on_steroids) in the acts_as_taggable class method  
being calledon initialization, it does the following:

> alias_method_chain :reload, :tag_list


Now, when something (namely better_nested_set) calls self.reload,  
reload_with_tag_list is called which in turn calls  
reload_without_tag_list (which is the original one). This is how it  
should work and how it works in rails context.

when i now start backgroundrb and self.reload is called, i get:

> #<SystemStackError: stack level too deep>
> /Users/micha/rails/dmt/trunk/vendor/plugins/ 
> acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:192:in  
> `reload_without_tag_list'
> /Users/micha/rails/dmt/trunk/vendor/plugins/ 
> acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:192:in `reload'
> /Users/micha/rails/dmt/trunk/vendor/plugins/betternestedset/lib/ 
> better_nested_set.rb:430:in `move_to'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ 
> connection_adapters/abstract/database_statements.rb:66:in  
> `transaction'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ 
> transactions.rb:80:in `transaction'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ 
> transactions.rb:100:in `transaction'
> /Users/micha/rails/dmt/trunk/vendor/plugins/betternestedset/lib/ 
> better_nested_set.rb:429:in `move_to'
> /Users/micha/rails/dmt/trunk/vendor/plugins/betternestedset/lib/ 
> better_nested_set.rb:421:in `move_to_child_of'
> /Users/micha/rails/dmt/trunk/lib/workers/processing_queue_worker.rb: 
> 194:in `process_convert_pdf'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ 
> connection_adapters/abstract/database_statements.rb:66:in  
> `transaction'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ 
> transactions.rb:80:in `transaction'
> /Users/micha/rails/dmt/trunk/lib/workers/processing_queue_worker.rb: 
> 191:in `process_convert_pdf'

with ruby-debug, i can see that acts_as_taggable is called more then  
once, doing the alias_method_chain more than once, too, so that  
reload_with_tag_list calls reload_with_taglist which calls  
reload_with_tag_list. if you don't understand that, try to sketch it :)

is this behaviour known, is it a bug or superman?

greetings,
Micha

---
Siebert WD
Michael Siebert
Trappenweg 6, 15749 Mittenwalde, Deutschland



More information about the Backgroundrb-devel mailing list