app/models/pulitzer/post.rb in pulitzer-0.15.20 vs app/models/pulitzer/post.rb in pulitzer-0.15.21
- old
+ new
@@ -1,10 +1,10 @@
module Pulitzer
class Post < Pulitzer::ApplicationRecord
include ForeignOffice::Broadcaster if defined? ForeignOffice
extend ::FriendlyId
- has_many :versions, dependent: :destroy, index_errors: true, inverse_of: :post
- has_one :active_version, -> { where(status: 'active') }, class_name: "Pulitzer::Version"
+ has_many :versions, -> { includes(free_form_sections: {partials: [{post_type_version: [:background_styles, :justification_styles, :sequence_flow_styles, :arrangement_styles]}, :content_elements, :background_style, :justification_style, :sequence_flow_style, :arrangement_style]}) }, dependent: :destroy, index_errors: true, inverse_of: :post
+ has_one :active_version, -> { where(status: 'active').includes(free_form_sections: {partials: [{post_type_version: [:background_styles, :justification_styles, :sequence_flow_styles, :arrangement_styles]}, :content_elements, :background_style, :justification_style, :sequence_flow_style, :arrangement_style]}) }, class_name: "Pulitzer::Version"
accepts_nested_attributes_for :versions
belongs_to :post_type_version
delegate :post_type_content_element_types, :free_form_section_types, :has_free_form_sections?, :has_templated_content_elements?, :post_type, :post_type_id, :plural?, to: :post_type_version