Sha256: db425893c5ec04a0f79aca5e569fe7639e2ac8895be3951cb2f86aa7f2047a77
Contents?: true
Size: 1.11 KB
Versions: 32
Compression:
Stored size: 1.11 KB
Contents
module Cms module Behaviors module Hiding def self.included(model_class) model_class.extend(MacroMethods) end module MacroMethods def hideable? !!@is_hideable end def is_hideable(options={}) @is_hideable = true extend ClassMethods include InstanceMethods named_scope :hidden, :conditions => {:hidden => true} named_scope :not_hidden, :conditions => {:hidden => false} end end module ClassMethods end module InstanceMethods def hide self.hidden = true self.version_comment = "Hidden" self.save end def hide! self.hidden = true self.version_comment = "Hidden" self.save! end def unhide self.hidden = false self.version_comment = "Unhidden" self.save end def unhide! self.hidden = false self.version_comment = "Unhidden" self.save! end end end end end
Version data entries
32 entries across 32 versions & 10 rubygems