Sha256: 249f6dd7de0a45d032fb73cf086e571cdcddac7febf10133421235c6f5908f5b
Contents?: true
Size: 665 Bytes
Versions: 18
Compression:
Stored size: 665 Bytes
Contents
module Ants module Featurable extend ActiveSupport::Concern included do # attributes field :featured, type: Boolean, default: false # scopes scope :featured, -> { where(featured: true) } scope :not_featured, -> { where(featured: false) } # indexes index({ featured: 1 }) # helpers def featured? self.featured end def set_featured! return if self.featured? self.featured = true self.save! end def unset_featured! return unless self.featured? self.featured = false self.save! end end end end
Version data entries
18 entries across 18 versions & 1 rubygems