Permalink
Browse files

instead of keeping our own list of callbacks here, use the list that …

…gets stored in active_record
  • Loading branch information...
1 parent 6c71acd commit 02ff3dd42fd4c380b73ded4bb3ab0a50591f8df2 @jamesgolick jamesgolick committed Aug 5, 2009
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/observational/active_record.rb
  2. +1 −1 spec/active_record_spec.rb
@@ -1,7 +1,7 @@
module Observational
module ActiveRecordObservers
def self.included(klass)
- [:after_create, :before_create, :before_save, :after_save].each do |callback|
+ ActiveRecord::Callbacks::CALLBACKS.each do |callback|
klass.send(callback) { |obj| obj.send :notify_observers, callback }
end
end
@@ -7,7 +7,7 @@
@user = User.new
end
- [:before_create, :after_create, :before_save, :after_save].each do |callback|
+ ActiveRecord::Callbacks::CALLBACKS.each do |callback|
describe "observing #{callback}" do
it "should fire the observer during that callback" do
self.expects(:subscription).with(@user)

0 comments on commit 02ff3dd

Please sign in to comment.