add slack notifications
This commit is contained in:
18
app/models/concerns/notifiable.rb
Normal file
18
app/models/concerns/notifiable.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
# frozen_string_literal: true
|
||||
module Notifiable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
after_commit on: :create do
|
||||
SlackNotifier.ping(notification_message)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def notification_message
|
||||
raise NotImplementedError, "method should be implemented"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user