lib/with_template/base.rb
def render_template(partial, variable=nil, &block)
      render_options = global_options.clone
      render_options[:captured_block] = view.capture(self, &block) if block_given?
      render_options[:options] = render_options
      variable ||= render_options.delete(:variable) || :template
      render_options[variable] = self

      view.render partial, render_options
    end
def render_template(partial, variable=nil, &block)
      render_options = global_options.clone
      render_options[:captured_block] = view.capture(self, &block) if block_given?
      render_options[:options] = render_options
      variable ||= render_options.delete(:variable) || :template
      render_options[variable] = self

      view.render partial, render_options
    end
def render_template ( partial , variable = nil , & block ) render_options = global_options . clone render_options [ :captured_block ] = view . capture ( self , block ) if block_given? render_options [ :options ] = render_options variable ||= render_options . delete ( :variable ) || :template render_options [ variable ] = self view . render partial , render_options end
Render a partial, treating it as a template, and any code in the block argument will impact how the template renders
   <%= WithTemplate::Base.new(self).render_template("shared/wizard") do |blocks| %>
     <% blocks.queue :step1 %>
     <% blocks.queue :step2 do %>
       My overridden Step 2 |
     <% end %>
     <% blocks.queue :step3 %>
     <% blocks.queue do %>
       | Anonymous Step 4
     <% end %>
   <% end %>

   <!-- In /app/views/shared/wizard -->
   <% blocks.define :step1 do %>
     Step 1 |
   <% end %>

   <% blocks.define :step2 do %>
     Step 2 |
   <% end %>

   <% blocks.define :step3 do %>
     Step 3
   <% end %>

   <% blocks.queued_blocks.each do |block| %>
     <%= blocks.render block %>
   <% end %>

   <!-- Will render: Step 1 | My overridden Step 2 | Step 3 | Anonymous Step 4-->
 Options:
 [+partial+]
   The partial to render as a template
 [+block+]
   An optional block with code that affects how the template renders
Render a partial treating it as a template and any code in the block argument will impact how the template renders <% = WithTemplate :: Base . new ( self ) . render_template ( shared / wizard ) do |blocks| % > <% blocks . queue : step1 % > <% blocks . queue : step2 do % > My overridden Step 2 | <% end % > <% blocks . queue : step3 % > <% blocks . queue do % > | Anonymous Step 4 <% end % > <% end % >