0

Sinatra has sinatra/contrib to asist with this, what's the equivalent in Ramaze? I'm using Erubis by the way. Also, a quick Google search shows up really old pages that insist setting variables in the controllers and using them in the views.

Edit 1:

Taken from the gem documentation (http://www.sinatrarb.com/contrib/content_for.html)

You call content_for, generally from a view, to capture a block of markup giving it an identifier:

# index.erb
<% content_for :some_key do %>
  <chunk of="html">...</chunk>
<% end %>

Then, you call yield_content with that identifier, generally from a layout, to render the captured block:

# layout.erb
<%= yield_content :some_key %>
Sunder
  • 1,445
  • 2
  • 12
  • 22

1 Answers1

0

I don't think Ramaze can do this natively. But you could quite easily do this manually, write a helper to do this, or even fill-in a Hash instance.

You might also want to look at partials if you need to render small chunks of HTML in loops.

You could also combine render_partial, store results in a hash, and yield it's content in the layout.

If the use case is something like rendering a sidebar, you probably want to write a helper so you take the logic out of your views.

A trivial example is here : https://github.com/Ramaze/ramaze/wiki/Adding-a-dynamic-sidebar-in-a-layout

leucos
  • 17,661
  • 1
  • 44
  • 34