Sha256: f69e448e8f42f9fb287bf3cb9f6af4a022c2f3d4534e1533efcb06863bd616d0
Contents?: true
Size: 1.25 KB
Versions: 13
Compression:
Stored size: 1.25 KB
Contents
class Pulitzer::UpdatePostTypeContentElements attr_accessor :post_type, :ptcet, :old_label def initialize(ptcet, old_label=nil) self.post_type = ptcet.post_type self.ptcet = ptcet self.old_label = old_label || ptcet.label end def call post_type.posts.each do |post| begin preview_version = post.get_preview_version! post.preview_version.content_elements.where(label: old_label).each do |content_element| content_element.update(label: ptcet.label, height: ptcet.height, width: ptcet.width, text_editor: ptcet.text_editor, content_element_type: ptcet.content_element_type, post_type_content_element_type: ptcet) end rescue Pulitzer::VersionAccessError # if there is no preview version, skip this one. end end post_type.partials.each do |partial| partial.content_elements.where(label: old_label).each do |content_element| content_element.update(label: ptcet.label, height: ptcet.height, width: ptcet.width, text_editor: ptcet.text_editor, content_element_type: ptcet.content_element_type, post_type_content_element_type: ptcet) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems