Sha256: de2d96abb7124e20e0ad0e269d5b6d1050f97fcc7de297c2ee5c8fd74d695f98
Contents?: true
Size: 1007 Bytes
Versions: 6
Compression:
Stored size: 1007 Bytes
Contents
module Pageflow class PublishedEntry include ActiveModel::Conversion extend ActiveModel::Naming attr_reader :entry, :revision delegate(:account, :theme, :to_model, :to_key, :persisted?, :to => :entry) delegate(:chapters, :pages, :image_files, :video_files, :audio_files, :title, :summary, :credits, :manual_start, :to => :revision) def initialize(entry, revision = nil) @entry = entry @revision = revision || entry.published_revision @custom_revision = !!revision end def stylesheet_model custom_revision? ? revision : entry end def thumbnail pages.first.try(:thumbnail) || ImageFile.new.processed_attachment end def self.find(id) PublishedEntry.new(Entry.published.find(id)) end def cache_key "#{self.class.model_name.cache_key}/#{entry.cache_key}-#{revision.cache_key}" end private def custom_revision? @custom_revision end end end
Version data entries
6 entries across 6 versions & 1 rubygems