Dean
Dean

Reputation: 1150

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

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?

Upvotes: 95

Views: 50510

Answers (2)

stevec
stevec

Reputation: 52268

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

def action
  render layout: false
end

Upvotes: 5

marcgg
marcgg

Reputation: 66436

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

For your question:

render :layout => false

or

layout false

Upvotes: 157

Related Questions