Skip to content

Instantly share code, notes, and snippets.

@tshddx
Created July 6, 2011 21:24
Show Gist options
  • Select an option

  • Save tshddx/1068361 to your computer and use it in GitHub Desktop.

Select an option

Save tshddx/1068361 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