Forum: Rails Engines development Mysterious StackError with habtm on destroy

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Manuel H. (Guest)
on 2006-02-19 19:35
(Received via mailing list)
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:in `users'
     (eval):3:in `destroy_without_habtm_shim_for_roles'
     (eval):4:in `destroy_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:in `destroy'
     /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:in `transaction'
     /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:in `destroy'
     /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:in `send'
     /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:in `perform_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:in `measure'
     /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:in `perform_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:in `process_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:in `process'
     /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:in `post'
     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'
Manuel H. (Guest)
on 2006-02-19 20:54
(Received via mailing list)
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
This topic is locked and can not be replied to.