app/models/pulitzer/partial.rb in pulitzer-0.15.11 vs app/models/pulitzer/partial.rb in pulitzer-0.15.12

- old
+ new

@@ -5,11 +5,11 @@ belongs_to :background_style belongs_to :justification_style belongs_to :sequence_flow_style belongs_to :arrangement_style has_one :post_type, through: :post_type_version - + has_many :content_elements, dependent: :destroy delegate :name, :post_type_content_element_types, :has_display?, :post_type_id, :version_number, to: :post_type_version delegate :template_path, to: :layout, allow_nil: true @@ -52,11 +52,11 @@ def available_arrangements post_type_version.arrangement_styles end def folder_path - name.downcase.gsub(/ /,'_').gsub(/\W/,'') + name.downcase.gsub(/ /,'_').gsub(/\W/,'') end def version_folder "v_#{version_number}" end @@ -84,7 +84,10 @@ my_clone.content_elements << cloned_content_element end my_clone end + def upgradable? + version_number < (post_type_version&.post_type&.post_type_versions&.published&.maximum(:version_number) || 0) + end end -end \ No newline at end of file +end