Ruby on Rails - How do I render an action without the application layout?

Ruby on-Rails

Ruby on-Rails Problem Overview


I have a rails app and I want to render an action without using my application layout (which has page header / footer stuff in it).

How could I go about doing this?

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

Here's some documentation about it: http://guides.rubyonrails.org/layouts_and_rendering.html

For your question:

render :layout => false

or

layout false

Solution 2 - Ruby on-Rails

For Rails 5, in the controller, for the specific action:

def action
  render layout: false
end

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDeanView Question on Stackoverflow
Solution 1 - Ruby on-RailsmarcggView Answer on Stackoverflow
Solution 2 - Ruby on-RailsstevecView Answer on Stackoverflow