aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-02 11:44:36 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-02 11:44:36 -0500
commit723a47bfb3708f968821bc969a9a3fc873a3ed58 (patch)
treecfc3e3121affbd420dfe3832602248b57847c710 /activeresource/lib
parente870e24887e829547abdb6592d614c52f5412132 (diff)
downloadrails-723a47bfb3708f968821bc969a9a3fc873a3ed58.tar.gz
rails-723a47bfb3708f968821bc969a9a3fc873a3ed58.tar.bz2
rails-723a47bfb3708f968821bc969a9a3fc873a3ed58.zip
Kill AMo observing wrap_with_notifications since ARes was only using it
Diffstat (limited to 'activeresource/lib')
-rw-r--r--activeresource/lib/active_resource/observing.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/activeresource/lib/active_resource/observing.rb b/activeresource/lib/active_resource/observing.rb
index 94836f4bb1..3c74d49c80 100644
--- a/activeresource/lib/active_resource/observing.rb
+++ b/activeresource/lib/active_resource/observing.rb
@@ -4,7 +4,18 @@ module ActiveResource
include ActiveModel::Observing
included do
- wrap_with_notifications :create, :save, :update, :destroy
+ %w( create save update destroy ).each do |method|
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ def #{method}_with_notifications(*args, &block)
+ notify_observers(:before_#{method})
+ if result = #{method}_without_notifications(*args, &block)
+ notify_observers(:after_#{method})
+ end
+ result
+ end
+ EOS
+ alias_method_chain(method, :notifications)
+ end
end
end
end