Sha256: ea95b85c7ea39ce59d5e49717451964dafdc282f2474b736c5c5ddb8edc0630f
Contents?: true
Size: 435 Bytes
Versions: 37
Compression:
Stored size: 435 Bytes
Contents
module Featureable extend ActiveSupport::Concern # Constants FEATURED = {"Featured" => true, "Non Featured" => false} FEATURED_REVERSE = {true => "Featured", false => "Non Featured"} included do scope :featured, lambda { |val| where(featured: val) } def mark_as_featured self.update_attribute(:featured, true) end def remove_from_featured self.update_attribute(:featured, false) end end end
Version data entries
37 entries across 37 versions & 1 rubygems