Sha256: 54c2589b79d3dbc40b16fe1a70dee8dcf382e30b1069e3662616719758d13f63
Contents?: true
Size: 1.17 KB
Versions: 13
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 Methods # ------------------ # 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
13 entries across 13 versions & 1 rubygems