No commit activity in last 3 years
No release in over 3 years
Gem allows defining helpers that accept multiple blocks
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

rails-multi_block_helpers

Gem allows defining helpers that accept multiple blocks

Installation

# Gemfile

gem 'rails-multi_block_helpers'

then bundle

Example

# application_helper.rb

def helper_taking_multiple_blocks(&block)
     ActiveSupport::SafeBuffer.new.tap do |html|
      html << content_tag(:div, id: 'block-1') do
        capture_section(:block_one, &block)
      end

      html << content_tag(:div, id: 'block-2') do
        capture_section(:block_two, &block)
      end
    end
end

# show.html.haml

= helper_taking_multiple_blocks do |section|
  - section.block_one do
    %p= "Some content here"
  - section.block_two do
    = link_to "One link", '#'
    = link_to "And another link", '#'