module AutoAlert::ActsAsAlertable::ClassMethods

Public Instance Methods

acts_as_alertable(with_table: :alerts) click to toggle source

Class method to register a model as alertable

# 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