method

render

Importance_2
v6.0.0 - Show latest stable - 0 notes - Class: Renderer
render(*args) public

Render templates with any options from ActionController::Base#render_to_string.

The primary options are:

  • :partial - See ActionView::PartialRenderer for details.

  • :file - Renders an explicit template file. Add :locals to pass in, if so desired. It shouldn’t be used directly with unsanitized user input due to lack of validation.

  • :inline - Renders an ERB template string.

  • :plain - Renders provided text and sets the content type as text/plain.

  • :html - Renders the provided HTML safe string, otherwise performs HTML escape on the string first. Sets the content type as text/html.

  • :json - Renders the provided hash or object in JSON. You don’t need to call .to_json on the object you want to render.

  • :body - Renders provided text and sets content type of text/plain.

If no options hash is passed or if :update is specified, the default is to render a partial and use the second parameter as the locals hash.

Show source
Register or log in to add new notes.