Module: IfreeSms::Smsing::ClassMethods

Defined in:
lib/ifree_sms/smsing.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ifree_sms/smsing.rb', line 12

def self.extended(base)
  base.class_eval do
    # Associations
    belongs_to :messageable, :polymorphic => true
    
    # Validations
    validates :sms_id, :phone, :service_number, :sms_text, :now, :presence => true
    validate :check_secret_key

    attr_accessible :request
    attr_accessor :md5key, :test, :answer_text
    
    scope :with_messageable, lambda { |record| where(["messageable_id = ? AND messageable_type = ?", record.id, record.class.name]) }
  end
end