app/models/pulitzer/post.rb in pulitzer-0.4.16 vs app/models/pulitzer/post.rb in pulitzer-0.5.0
- old
+ new
@@ -5,14 +5,12 @@
has_many :versions
has_one :active_version, -> { active }, class_name: "Pulitzer::Version"
belongs_to :post_type
delegate :post_type_content_element_types, :free_form_section_types, :has_free_form_sections?, :has_templated_content_elements?, to: :post_type
- delegate :content_elements, :section, :has_label_type, :has_label, :post_tags_for, to: :active_version, allow_nil: true
+ delegate :post_tags, :content_elements, :content_element, :section, :has_label_type, :has_label, :post_tags_for, to: :active_version, allow_nil: true
- has_many :post_tags, through: :active_version
-
friendly_id :title, use: [:slugged, :finders]
after_create :create_preview_version
attr_accessor :new_preview_version
@@ -20,15 +18,9 @@
TAG_MODELS = ["Pulitzer::Tag"] + Pulitzer.tagging_models
def tags
post_tags.map(&:label)
- end
-
- def content_element(label)
- if content_elements
- self.content_elements.find_by(label: label)
- end
end
def should_generate_new_friendly_id?
new_record? || title_changed?
end