<commit_before>module BlockHelper

  def render_blocks(record, options = {})
    return if record.blank?

    begin
      block_layout = options[:block_layout].presence || BlockLayout.default_layout
      if block_layout.is_a?(Symbol)
        block_layout = BlockLayout.find_by_slug(block_layout)
      end

      content_tag :div, class: "blocks block-layout--#{block_layout.slug}" do
        render partial: 'blocks/show', collection: record.blocks(block_layout: block_layout).reject(&:hidden?), as: 'block'
      end
    rescue Exception => e
      forest_admin_error(e)
    end
  end

end<commit_msg>Update render_blocks helper to only render wrapper div when present?<commit_after>module BlockHelper

  def render_blocks(record, options = {})
    return if record.blank?

    begin
      block_layout = options[:block_layout].presence || BlockLayout.default_layout

      if block_layout.is_a?(Symbol)
        block_layout = BlockLayout.find_by_slug(block_layout)
      end

      collection = record.blocks(block_layout: block_layout).reject(&:hidden?)

      if collection.present?
        content_tag :div, class: "blocks block-layout--#{block_layout.slug}" do
          render partial: 'blocks/show', collection: collection, as: 'block'
        end
      end
    rescue Exception => e
      forest_admin_error(e)
    end
  end

end
{'fraction_non_alphanumeric': 0.09701492537313433, 'fraction_numerical': 0.0, 'mean_word_length': 3.3680781758957656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '329873', 'n_tokens_mistral': 390, 'n_tokens_neox': 393, 'n_words': 91}