This is a nice little trick to defer some block execution in a multi-pane layout

module Views
  def layout
    html do
      #...
      body do
        div.main { yield }
        div.right! &@_right_pane if @_right_pane
      end
    end
  end

  def _right_pane(&block)
    @_right_pane = block
  end

  # So now on your view
  def some_view
    # use that method if you need the right pane
    _right_pane do
      # Some code in the right pane
    end

    # And here goes your regular view
  end
end

Cheers,
  zimbatm
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to