Sha256: 2c9c56c48800f2c98e39d6e5b76c20c1824f87b66f92d12a095065990c4e258c
Contents?: true
Size: 577 Bytes
Versions: 1
Compression:
Stored size: 577 Bytes
Contents
module Mongoid::Activity extend ActiveSupport::Concern included do field :active, :type => Boolean index :active scope :inactive, :where => { :active => false } scope :active, :where => { :active => true } def activate! new_record? ? self.active = true : update_attributes(:active => true) active? end def deactivate! new_record? ? self.active = false : update_attributes(:active => false) inactive? end def active? active end def inactive? !active end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid_activity-0.0.2 | lib/mongoid_activity.rb |