Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from FND/hooks_fix

Fix use of destroy hooks
  • Loading branch information...
commit 97fe1d877ddcd8d5edb1e370d0a0b5398e21039a 2 parents 65850e2 + 07902e2
@snusnu authored
Showing with 7 additions and 1 deletion.
  1. +1 −1  lib/dm-is-awesome_set.rb
  2. +6 −0 spec/dm-is-awesome_set_spec.rb
View
2  lib/dm-is-awesome_set.rb
@@ -265,7 +265,7 @@ def attributes_set(hash) #:nodoc:
# Returns the destroyed objects
def destroy
sads = self_and_descendants
- hooks = get_class.const_get('INSTANCE_HOOKS')
+ hooks = get_class.hooks
before_methods = hooks[:destroy][:before].map { |hash| hash[:name] }
after_methods = hooks[:destroy][:after].map { |hash| hash[:name] }
# Trigger all the before :destroy methods
View
6 spec/dm-is-awesome_set_spec.rb
@@ -841,6 +841,12 @@
end
end
+ it "destroys objects as intended" do
+ c1 = Category.create
+
+ expect{c1.destroy}.to_not raise_error(NoMethodError)
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.