Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3175 (closed defect: worksforme)

Opened 4 years ago

Last modified 2 years ago

unable to delete items on some habtm associations

Reported by: anonymous Assigned to: David
Priority: high Milestone:
Component: ActiveRecord Version:
Severity: critical Keywords:
Cc:

Description

Quite wierd, but also annoying.

I have a few habtm associations in my app, eg, users -> roles and roles -> permissions.

Now deleting a role is easy and works. But when I want to delete a user it fails. I get the following error.

SystemStackError: stack level too deep
from .//vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:62:in `clear'
from (eval):3:in `destroy_without_habtm_shim_for_roles'
from (eval):4:in `destroy_without_habtm_shim_for_roles'
from (eval):4:in `destroy_without_callbacks'
from .//vendor/rails/activerecord/lib/active_record/callbacks.rb:321:in `destroy_without_transactions'
from .//vendor/rails/activerecord/lib/active_record/transactions.rb:122:in `destroy'
from .//vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in `transaction'
from .//vendor/rails/activerecord/lib/active_record/transactions.rb:91:in `transaction'
from .//vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `transaction'
from .//vendor/rails/activerecord/lib/active_record/transactions.rb:122:in `destroy'
from (irb):2

I've run it from both trunk and stable, but neither seem to work. I decided to look back at any possible changes that mightve caused this. Unfortunately we havent been running tests like we should be, so this is partially my fault, but I foud a change, in changeset 2940, for associations.rb this is where the problem starts. I didnt revert back to 2940, but merely switched over the code in the section to the old version and now im able to delete again.

I hope this is able to be fixed as its just a normal habtm association.

Change History

01/05/06 14:03:26 changed by Eric

There's also a thread on this at:

http://www.ruby-forum.com/topic/50273

02/09/06 21:07:41 changed by BobSilva

This does not appear to be an issue any longer in edge rails.

(follow-up: ↓ 4 ) 02/27/06 03:16:26 changed by nzkoz

  • status changed from new to closed.
  • resolution set to worksforme.

I'm unable to trigger this given the information you've provided. If this is still happening please reopen the ticket and provide more information.

(in reply to: ↑ 3 ) 02/15/07 23:04:42 changed by wolpert

Bug opened as 7570 with patch submitted.