docbrown/app/observers/organization_observer.rb
2019-03-21 13:00:21 -04:00

14 lines
393 B
Ruby

class OrganizationObserver < ActiveRecord::Observer
def after_create(organization)
return if Rails.env.development?
SlackBot.delay.ping(
"New Org Created: #{organization.name}\nhttps://dev.to/#{organization.username}",
channel: "orgactivity",
username: "org_bot",
icon_emoji: ":office:",
)
rescue StandardError => e
Rails.logger.error(e)
end
end