开发者

Is it possible to not yield from a certain page?

Trying to have a p开发者_开发百科age which will not take everything from layouts/application.html.erb, Is it possible?


In your controller:

def my_action
  render :layout => false
end


The following will display your content unless you are on a specific page:

yield(:something) unless controller_name == 'mycontroller' and action_name == 'myaction'

The following will output header and includes unless you are on a specific page:

if controller_name == 'mycontroller' and action_name == 'myaction'
  javascript_include_tag :defaults
  javascript_include_tag 'anotherscript.js'
  yield(:head)
end


Calling render :action => "foo", :layout => false in your controller will skip your layout entirely.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜