Mysterious StackError with habtm on destroy

Hi

I am getting a kind of mysterious error when deleting a group in my
unit tests. I get this error when calling the “destroy” action in my
controller, so the only different thing is that it is called from a
unit test instead of running in Webrick.

I am calling Group.find(params[:id]).destroy in my controller. Group
has_and_belongs_to_many User and Role objects. The same code does not
give errors when running as a component but it does when running as
an Engine. Thus, I suspect something is breaking along the way.

Has anyone else experienced a problem like this?

Regards,

Manuel

====

This is the error:

  1. Error:
    test_should_destroy_group_on_destroy_post_with_answer_yes_and_valid_grou
    p_id(ActiveRbac::GroupControllerTest):
    SystemStackError: stack level too deep
    /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
    rbac_demo/vendor/rails/activerecord/lib/active_record/associations.rb:
    752:in users' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/activerecord/lib/active_record/associations.rb: 750:inusers’
    (eval):3:in destroy_without_habtm_shim_for_roles' (eval):4:indestroy_without_habtm_shim_for_users’
 [these two lines are repeated a lot of times]

 (eval):4:in `destroy_without_callbacks'
 /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/

rbac_demo/vendor/rails/activerecord/lib/active_record/callbacks.rb:
321:in destroy_without_transactions' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/activerecord/lib/active_record/transactions.rb: 122:indestroy’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/activerecord/lib/active_record/transactions.rb:
122:in transaction' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/activerecord/lib/active_record/transactions.rb: 91:intransaction’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/activerecord/lib/active_record/transactions.rb:
118:in transaction' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/activerecord/lib/active_record/transactions.rb: 122:indestroy’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/plugins/active_rbac/app/controllers/active_rbac/
group_controller.rb:131:in destroy' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/actionpack/lib/action_controller/base.rb: 853:insend’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/actionpack/lib/action_controller/base.rb:
853:in perform_action_without_filters' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/actionpack/lib/action_controller/filters.rb: 332:inperform_action_without_benchmark’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/actionpack/lib/action_controller/
benchmarking.rb:69:in perform_action_without_rescue' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:69:inmeasure’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/actionpack/lib/action_controller/
benchmarking.rb:69:in perform_action_without_rescue' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/actionpack/lib/action_controller/rescue.rb: 82:inperform_action’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/actionpack/lib/action_controller/base.rb:
369:in send' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/actionpack/lib/action_controller/base.rb: 369:inprocess_without_session_management_support’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/actionpack/lib/action_controller/
session_management.rb:116:in process_without_test' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/actionpack/lib/action_controller/ test_process.rb:16:inprocess’
/Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/
rbac_demo/vendor/rails/actionpack/lib/action_controller/
test_process.rb:300:in process' /Users/manuel/Development/Rails/arbac.ts.com/rbac_demo/trunk/ rbac_demo/vendor/rails/actionpack/lib/action_controller/ test_process.rb:307:inpost’
vendor/plugins/active_rbac/test/functional/
group_controller_test.rb:245:in
`test_should_destroy_group_on_destroy_post_with_answer_yes_and_valid_gro
up_id’

Am 19.02.2006 um 15:56 schrieb Manuel H.:

an Engine. Thus, I suspect something is breaking along the way.

Has anyone else experienced a problem like this?

Never mind. I solved this by making sure that my User model file was
only included once. I tried to run the same tests as a component
would require and did not read the documentation of Engines before.

Regards,

Manuel