Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActiveRecord::HasManyThroughCantAssociateThroughHasManyReflection being thrown when calling destroy_all on a :has_many :through association

#2688

As of this commit, calling destroy_all on a :has_many :through association raises an ActiveRecord::HasManyThroughCantAssociateThroughHasManyReflection exception. This wasn't the case before this commit.

e.g. Given:

class Company
  has_many :projects, :through => :contacts
end

Calling company.projects.destroy_all results in:

ActiveRecord::HasManyThroughCantAssociateThroughHasManyReflection: Cannot modify association 'MyClass#projects' because the source reflection class 'Project' is associated to 'Contact' via :has_many

Calling company.projects.all.destroy_all works, however.

Reported by Olly Headey · May 21st, 2009 @ 01:04 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Olly Headey
    Olly Headey

    Please ignore (or delete) this ticket. Instead I have added a comment in the correct place (https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets....

    I would delete it myself but there doesn't seem to be an option to do so.

    May 22nd, 2009 @ 03:48 PM

  2. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to invalid

    May 22nd, 2009 @ 05:28 PM

  3. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 11th, 2010 @ 10:56 AM

  4. bingbing