Sha256: 2895d0956e4b1442889206986cd84eb8f0e257d433f8a3396f766b11dd177b56

Contents?: true

Size: 483 Bytes

Versions: 29

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

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

29 entries across 29 versions & 1 rubygems

Version Path
pages_core-3.15.5 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.15.4 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.15.3 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.15.2 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.15.1 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.14.0 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.13.0 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.7 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.6 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.5 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.4 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.3 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.2 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.1 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.12.0 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.11.3 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.11.2 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.11.1 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.11.0 app/models/concerns/pages_core/page_model/autopublishable.rb
pages_core-3.10.2 app/models/concerns/pages_core/page_model/autopublishable.rb