def rebuild_page_content(locale)
      unless page_part && page_part.template
        raise "page_part with valid template not available"
      end
      # page_part = self.page_parts.find_by_page_part_key page_part_key

      if page_part.present?
        l_template = Liquid::Template.parse(page_part.template)
        new_fragment_html = l_template.render('page_part' => page_part.block_contents[locale]["blocks"] )
        # p "#{page_part_key} content for #{self.slug} page parsed."
        # save in content model associated with page

        page_fragment_content = find_or_create_content
        # container.contents.find_or_create_by(page_part_key: page_part_key)
        content_html_col = "raw_" + locale + "="
        # above is the col used by globalize gem to store localized data
        # page_fragment_content[content_html_col] = new_fragment_html
        page_fragment_content.send content_html_col, new_fragment_html
        page_fragment_content.save!

        # set page_part_key value on join model
        page_content_join_model = get_join_model
        # page_fragment_content.page_contents.find_by_page_id self.id
        page_content_join_model.page_part_key = page_part_key
        page_content_join_model.save!
      else
        new_fragment_html = ""
      end

      new_fragment_html
    end
def rebuild_page_content(locale)
      unless page_part && page_part.template
        raise "page_part with valid template not available"
      end
      # page_part = self.page_parts.find_by_page_part_key page_part_key

      if page_part.present?
        l_template = Liquid::Template.parse(page_part.template)
        new_fragment_html = l_template.render('page_part' => page_part.block_contents[locale]["blocks"] )
        # p "#{page_part_key} content for #{self.slug} page parsed."
        # save in content model associated with page

        page_fragment_content = find_or_create_content
        # container.contents.find_or_create_by(page_part_key: page_part_key)
        content_html_col = "raw_" + locale + "="
        # above is the col used by globalize gem to store localized data
        # page_fragment_content[content_html_col] = new_fragment_html
        page_fragment_content.send content_html_col, new_fragment_html
        page_fragment_content.save!

        # set page_part_key value on join model
        page_content_join_model = get_join_model
        # page_fragment_content.page_contents.find_by_page_id self.id
        page_content_join_model.page_part_key = page_part_key
        page_content_join_model.save!
      else
        new_fragment_html = ""
      end

      new_fragment_html
    end
Will retrieve saved page_part blocks and use that along with template
 to rebuild page_content html