Skip to content

Instantly share code, notes, and snippets.

@bsodmike
Forked from tshddx/gist:1068361
Created July 6, 2011 21:29
Show Gist options
  • Select an option

  • Save bsodmike/1068376 to your computer and use it in GitHub Desktop.

Select an option

Save bsodmike/1068376 to your computer and use it in GitHub Desktop.
Rails. Render a layout outside a controller, with text and locals
av = ActionView::Base.new(Rails::Configuration.new.view_path)
av.render(
{:text => this_goes_to_yield, :layout => "layouts/blah.html.erb"}, # the options hash
{:title => 'blah', :body => 'hello'} # the locals hash
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment