Sha256: efebe66e382e91714fa98809667646b672dce65e5a0556bdbeb30dce5bdc96c9

Contents?: true

Size: 554 Bytes

Versions: 9

Compression:

Stored size: 554 Bytes

Contents

class Pulitzer::DestroyFreeFormSectionPartials

  def initialize(partial_type)
    @partial_type = partial_type
  end

  def call
    free_form_section_type  = @partial_type.free_form_section_type
    post_type               = free_form_section_type.post_type
    post_type.posts.each do |post|
      if post.preview_version
        free_form_section = post.preview_version.free_form_sections.find_by(name: free_form_section_type.name)
        partial = free_form_section.partials.find_by(label: @partial_type.label)&.destroy
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pulitzer-0.14.4 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.14.3 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.14.2 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.14.1 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.14.0 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.13.1 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.12.5 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.13.0 app/interactions/pulitzer/destroy_free_form_section_partials.rb
pulitzer-0.12.4 app/interactions/pulitzer/destroy_free_form_section_partials.rb