Created
May 5, 2021 15:05
-
-
Save julianrubisch/1bb354960f61beeeababb5cb104900b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/application_record.rb | |
class ApplicationRecord < ActiveRecord::Base | |
self.abstract_class = true | |
cattr_accessor :skip_callbacks | |
end | |
# app/models/concerns/user_notifiable.rb | |
module UserNotifiable | |
included do | |
after_commit :notify_users, unless: :skip_callbacks | |
end | |
end | |
# db/seeds.rb | |
ApplicationRecord.skip_callbacks = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment