Sha256: b4d58aa774b15d6322ad72e84b877f8476cba4f1c525669ac82c1b6bb3816941

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

# encoding: utf-8

module PagesCore
  module PageModel
    module Autopublishable
      extend ActiveSupport::Concern

      included do
        before_validation :set_autopublish
        after_save :queue_autopublisher
      end

      private

      def set_autopublish
        self.autopublish = published_at? && published_at > Time.now.utc
        true
      end

      def queue_autopublisher
        Autopublisher.queue! if autopublish?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_core-3.5.1 app/models/concerns/pages_core/page_model/autopublishable.rb