Module: Cms::Behaviors::Userstamping::MacroMethods

Defined in:
lib/cms/behaviors/userstamping.rb

Instance Method Summary collapse

Instance Method Details

#is_userstamped(_options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cms/behaviors/userstamping.rb', line 13

def is_userstamped(_options={})
  @is_userstamped = true
  extend ClassMethods
  include InstanceMethods

  belongs_to :created_by, class_name: Cms.user_class_name
  belongs_to :updated_by, class_name: Cms.user_class_name

  before_save :set_userstamps

  scope :created_by, lambda { |user| { conditions: { created_by: user } } }
  scope :updated_by, lambda { |user| { conditions: { updated_by: user } } }
end

#userstamped?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/cms/behaviors/userstamping.rb', line 9

def userstamped?
  !!@is_userstamped
end