docbrown/app/observers/organization_observer.rb
Anna Buianova 18d1300341 Moved SlackBot.delay.ping calls to ActiveJob #3136 (#3139)
* Moved SlackBot.delay.ping calls to ActiveJob

* Removed unused user creation from the spec
2019-06-12 09:23:37 -04:00

14 lines
412 B
Ruby

class OrganizationObserver < ActiveRecord::Observer
def after_create(organization)
return if Rails.env.development?
SlackBotPingJob.perform_later(
message: "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