Sha256: f99276b13f23400901de99e7e481b219fc1d21e2a040236ee61d5fa0b12e3629

Contents?: true

Size: 677 Bytes

Versions: 29

Compression:

Stored size: 677 Bytes

Contents

module Locomotive
  module Concerns
    module Site
      module Cache

        extend ActiveSupport::Concern

        included do

          ## fields ##
          field :cache_enabled,     type: Boolean, default: false
          field :template_version,  type: DateTime
          field :content_version,   type: DateTime

          ## callbacks ##
          before_save  :touch_content_version

          def touch_content_version
            touch(:content_version)
            true
          end

        end

        def last_modified_at
          [self.content_version, self.template_version].compact.sort.last || self.updated_at
        end

      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
locomotivecms-3.0.1 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0.rc7 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0.rc6 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0.rc5 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0.rc4 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0.rc3 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0.rc2 app/models/locomotive/concerns/site/cache.rb
locomotivecms-3.0.0.rc1 app/models/locomotive/concerns/site/cache.rb