Module: Mongoid::PublishingLogic

Extended by:
ActiveSupport::Concern, selfself::ModuleMethods
Included in:
Localized
Defined in:
lib/mongoid/publishing_logic.rb,
lib/mongoid/publishing_logic/version.rb

Defined Under Namespace

Modules: Localized, ModuleMethods

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.activeObject

Returns the value of attribute active.



10
11
12
# File 'lib/mongoid/publishing_logic.rb', line 10

def active
  @active
end

Instance Method Details

#published?Boolean

Returns:

  • (Boolean)


58
59
60
61
62
63
64
65
66
67
# File 'lib/mongoid/publishing_logic.rb', line 58

def published?
  if PublishingLogic.active?
    published_flag && (
      (publishing_date.nil? || publishing_date <= Date.today) &&
      (publishing_end_date.nil? || publishing_end_date > Date.today)
    )
  else
    true
  end
end