bypass application.html.erb in Rails app bypass application.html.erb in Rails app ruby-on-rails ruby-on-rails

bypass application.html.erb in Rails app


Use

render :layout => false

or

render :layout => 'whatever'

in your action. If you are using a separate LandingController you simply can create a app/views/layouts/landing.html.erb which will be picked up or you can override the layout via

class LandingController < ApplicationController  layout 'whatever'  ...end


You can set a layout in your render function:

render {other arguments}, :layout => :homepage

You can also set that option to false to not use any layout at all.

You can do something similar if you want an entire controller to use a custom layout:

class MyController < ApplicationController    layout :homepage    #...end

Hope that helps!


In the controller that renders the view, change the render to:

render :layout => false

You can read more about options to render and how to work with layouts at the Rails guide to render and layouts.