lib/webhook_system/subscription.rb in webhook_system-2.1.5 vs lib/webhook_system/subscription.rb in webhook_system-2.1.6

- old
+ new

@@ -2,10 +2,12 @@ # This is the model encompassing the actual record of a webhook subscription class Subscription < ActiveRecord::Base self.table_name = 'webhook_subscriptions' + belongs_to :account if defined?(Account) + validates :url, presence: true, url: { no_local: true } validates :secret, presence: true has_many :topics, class_name: 'WebhookSystem::SubscriptionTopic', dependent: :destroy has_many :event_logs, class_name: 'WebhookSystem::EventLog', dependent: :delete_all @@ -57,7 +59,14 @@ new_topics_attributes += add_topics.map { |topic| { name: topic } } self.topics_attributes = new_topics_attributes end + def account_info + if defined?(Account) + "#{account_id}:#{account.try(:name)}" + else + account_id.to_s + end + end end end