How to render a template and layout?
In a controller method, how can you render a template and layout?
Like so:
def new开发者_如何转开发
render :template => 'devise/invitations/new', :layout => 'application_unauthorized2_t2'
end
Instead of just being an options hash, like most rails methods, the render method is a series of arguments, the last of which is an options hash. The first argument to render is the template, as a string. You don't need to include it in the options hash.
Just do this:
def new
render 'devise/invitations/new', :layout => 'application_unauthorized2_t2'
end
Using a Class level layout method
精彩评论