"Exception: stack level too deep" on collection.clear?

Without getting too deep into my app I’m wondering if anyone has any
clues what might give rise to the error posted below. It occurs when
I run my unit tests.

class Actor < AR:Base
belongs_to :court_case
end

class CaseCause < AR:Base
belongs_to :court_case
end

class CourtCase < AR:Base
has_many :actors
has_many :case_causes

end

def my_test_method
… kase.actors.clear
end

def my_other_method
… kase.case_causes.clear
end

Also, Actor and CaseCause both have observers on them that attempt to
update CourtCase.


Exception: stack level too deep
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
associations/association_collection.rb:69:in clear' (eval):3:indestroy_without_habtm_shim_for_actors’
(eval):4:in destroy_without_habtm_shim_for_actors' (eval):4:indestroy_without_callbacks’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
callbacks.rb:321:in destroy_without_transactions' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ transactions.rb:125:indestroy’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
connection_adapters/abstract/database_statements.rb:59:in
transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ transactions.rb:95:intransaction’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
transactions.rb:121:in transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ transactions.rb:125:indestroy’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
associations/has_many_association.rb:168:in delete_records' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ associations/has_many_association.rb:168:ineach’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
associations/has_many_association.rb:168:in delete_records' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ associations/association_collection.rb:59:indelete’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
connection_adapters/abstract/database_statements.rb:59:in
transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ transactions.rb:95:intransaction’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
transactions.rb:121:in transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ associations/association_collection.rb:57:indelete’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
associations/association_collection.rb:41:in delete_all' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ associations/association_collection.rb:74:inclear’
C:\Documents and Settings\andy.PCSSINC.000\My Documents\RailsProjects
\rJems/test/unit/court_case_test.rb:162:in
test_removal_of_required_causes_from_active_case' C:/ruby/lib/ruby/1.8/test/unit/testcase.rb:72:insend
C:/ruby/lib/ruby/1.8/test/unit/testcase.rb:72:in run' C:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:inrun’
C:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in each' C:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:inrun’
C:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' C:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:ineach’
C:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' C:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:inrun_suite’
C:/Program Files/RadRails/plugins/
org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/
RemoteTestRunner.rb:107:in start_mediator' C:/Program Files/RadRails/plugins/ org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/ RemoteTestRunner.rb:52:instart’
C:/Program Files/RadRails/plugins/
org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/
RemoteTestRunner.rb:272

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs