diff --git a/lib/active_touch/define_touch.rb b/lib/active_touch/define_touch.rb index d6cabed..5c0b667 100644 --- a/lib/active_touch/define_touch.rb +++ b/lib/active_touch/define_touch.rb @@ -17,10 +17,10 @@ def initialize(klass, association, options) def define define_update_touch_method - add_active_record_callback(@update_touch_method) + add_active_record_callback(:after_commit, @update_touch_method) define_destroy_touch_method - add_active_record_callback(@destroy_touch_method) + add_active_record_callback(:after_destroy, @destroy_touch_method) add_to_network end @@ -60,8 +60,8 @@ def define_destroy_touch_method end end - def add_active_record_callback(method) - @klass.send(:after_commit) { send(method) } + def add_active_record_callback(event, method) + @klass.send(event) { send(method) } end def add_to_network diff --git a/lib/active_touch/version.rb b/lib/active_touch/version.rb index 1db114e..cb4be2e 100644 --- a/lib/active_touch/version.rb +++ b/lib/active_touch/version.rb @@ -1,3 +1,3 @@ module ActiveTouch - VERSION = '4.0.0' + VERSION = '4.0.1' end