Module: AutoAlert::ActsAsAlertable::ClassMethods

Defined in:
lib/auto_alert/acts_as_alertable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_alertable(with_table: :alerts) ⇒ Object

Class method to register a model as alertable



7
8
9
10
11
12
13
14
# File 'lib/auto_alert/acts_as_alertable.rb', line 7

def acts_as_alertable(with_table: :alerts)
  cattr_accessor :alerts_table_name, default: with_table
  alias_attribute :alerts, with_table unless with_table.to_sym == :alerts
  cattr_accessor :alert_checkers, default: []
  has_many with_table.to_sym, as: :alertable, dependent: :destroy
  include AutoAlert::ActsAsAlertable::LocalInstanceMethods
  extend AutoAlert::ActsAsAlertable::SingletonMethods
end