Skip to content

Commit

Permalink
Use after_commit for tracked callbacks instead of after_create/after_…
Browse files Browse the repository at this point in the history
…update
  • Loading branch information
Nguyễn Đức Long committed Mar 11, 2019
1 parent 07f13c1 commit ea244c3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/activity_notification/roles/acts_as_notifiable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,7 @@ def add_tracked_callbacks(target_type, tracked_option = {})
# @param [Symbol] tracked_action Tracked action (:create or :update)
# @param [Proc] tracked_proc Proc or lambda function to execute
def add_tracked_callback(tracked_callbacks, tracked_action, tracked_proc)
if tracked_callbacks.include? tracked_action
case tracked_action
when :create
after_create tracked_proc
when :update
after_update tracked_proc
end
end
after_commit(tracked_proc, on: tracked_action) if tracked_callbacks.include? tracked_action
end

# Adds destroy dependency.
Expand Down

0 comments on commit ea244c3

Please sign in to comment.