Skip to content

Commit ccda156

Browse files
committed
Use after_commit in Sync::Model to fix rendering errors triggering rollbacks. Close chrismccord#43.
1 parent 4a4ce73 commit ccda156

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/sync/model.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ def sync(*actions)
3939
actions.flatten!
4040

4141
if actions.include? :create
42-
after_create :publish_sync_create, if: -> { Sync::Model.enabled? }
42+
after_commit :publish_sync_create, on: :create, if: -> { Sync::Model.enabled? }
4343
end
4444
if actions.include? :update
45-
after_update :publish_sync_update, if: -> { Sync::Model.enabled? }
45+
after_commit :publish_sync_update, on: :update, if: -> { Sync::Model.enabled? }
4646
end
4747
if actions.include? :destroy
48-
after_destroy :publish_sync_destroy, if: -> { Sync::Model.enabled? }
48+
after_commit :publish_sync_destroy, on: :destroy, if: -> { Sync::Model.enabled? }
4949
end
5050
end
5151
end

0 commit comments

Comments
 (0)