Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relationships with dependency:destroy cause ActiveRecord::RecordNotFound #118

Closed
skahlert opened this issue Apr 25, 2014 · 6 comments
Closed

Comments

@skahlert
Copy link

For more details see this page:
http://stackoverflow.com/questions/17695206/dependent-destroy-with-acts-as-tree-and-acts-as-list

@bombino
Copy link

bombino commented Jun 30, 2014

+1, this is affecting us in production as well. Downgrading to 0.1.8 is a successful workaround.

Here's another successful workaround (monkeypatch):

module ActiveRecord
  module Acts 
    module List
      module InstanceMethods
        def reload_position
          # noop, because of https://github.com/swanandp/acts_as_list/issues/118
        end
      end
    end
  end
end

This commit should be reverted:
f62c432

@swanandp
Copy link
Contributor

swanandp commented Jul 2, 2014

PR #46 caused it, I am reviewing it now.

@lemonfrog
Copy link

+1 for bombinos suggestion.

@brendon
Copy link
Owner

brendon commented Apr 17, 2016

#201 should have fixed this one. We lock! doesn't reload if the record is no longer persisted (i.e. it's new or deleted).

@brendon brendon closed this as completed Apr 17, 2016
@jaredmoody
Copy link

jaredmoody commented Nov 8, 2017

I'm experiencing this issue on v0.9.9 - e.g.

class Project
  has_many :tasks, dependent: :destroy
end

class Task
  acts_as_list scope: :project_id
end

Both project.destroy and project.tasks.destroy_all give me an ActiveRecord::RecordNotFound error when multiple tasks exist.

@brendon
Copy link
Owner

brendon commented Nov 8, 2017

Hi @jaredmoody, can you do a PR with a failing test case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants