Sha256: 8b86dcc8923620634c4dab58d2ef5ff3d2c9b08bbb9c13da5b8fe034adcd3b7f
Contents?: true
Size: 1.17 KB
Versions: 5
Compression:
Stored size: 1.17 KB
Contents
class Dhatu::PromotionEnquiry < Dhatu::ApplicationRecord # Set Table Name self.table_name = "promotion_enquiries" # Including the State Machine Methods include Readable include Featureable # Validations # Associations belongs_to :promotion # Serializers serialize :additional_attributes, Hash # ------------------ # Class Methods # ------------------ scope :search, lambda {|query| where("LOWER(name) LIKE LOWER('%#{query}%') OR\ LOWER(email) LIKE LOWER('%#{query}%') OR\ LOWER(mobile) LIKE LOWER('%#{query}%') OR\ LOWER(message) LIKE LOWER('%#{query}%')")} scope :upcoming, lambda { where("created_at >= ?", Time.now) } scope :past, lambda { where("created_at < ?", Time.now) } # ------------------ # Instance variables # ------------------ # Generic Methods # --------------- def to_param "#{id}-#{name.parameterize[0..32]}" end def display_name "#{name_was}" end # Permission Methods # ------------------ def can_be_edited? false end def can_be_deleted? status?(:removed) end end
Version data entries
5 entries across 5 versions & 1 rubygems