开发者

How to render a template and layout?

开发者 https://www.devze.com 2023-03-06 01:14 出处:网络
In a controller method, how can you render a template and layout? Like so: def new开发者_如何转开发

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

0

精彩评论

暂无评论...
验证码 换一张
取 消