开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜