Sha256: d69a4b19015f090145d86c0b5f3c3b8c2944b13dd285e5a1138036eb3743df0a
Contents?: true
Size: 994 Bytes
Versions: 3
Compression:
Stored size: 994 Bytes
Contents
module Pulitzer class Post < ActiveRecord::Base extend ::FriendlyId has_many :versions belongs_to :post_type delegate :post_type_content_element_types, to: :post_type delegate :content_elements, :post_tags, to: :active_version, allow_nil: true friendly_id :title, use: [:slugged, :finders] after_create :create_preview_version validates :title, presence: true TAG_MODELS = ["Pulitzer::Tag"] + Pulitzer.tagging_models def content_element(label) self.content_elements.find_by(label: label) end def should_generate_new_friendly_id? new_record? || title_changed? end def active_version versions.active.last end def preview_version versions.preview.last end def processing_version versions.processing.last end def create_preview_version versions.create(status: :preview) end def create_processing_version versions.create(status: :processing) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pulitzer-0.2.2 | app/models/pulitzer/post.rb |
pulitzer-0.2.1 | app/models/pulitzer/post.rb |
pulitzer-0.2.0 | app/models/pulitzer/post.rb |