Skip to content

Instantly share code, notes, and snippets.

@cmaujean
Created July 8, 2011 21:13
Show Gist options
  • Save cmaujean/1072833 to your computer and use it in GitHub Desktop.
Save cmaujean/1072833 to your computer and use it in GitHub Desktop.
nested destroy problem
class Bar < ActiveRecord::Base
acts_as_nested_set :dependent => :destroy
belongs_to :foo
end
> Foo.destroy_all
ActiveRecord::RecordNotFound: Couldn't find Bar with ID=2
class Foo < ActiveRecord::Base
has_many :bars, :dependent => :destroy
has_one :root, :class_name => 'Bar', :conditions => "parent_id is null"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment