必须显式呈现:layout =>我的Rails 3应用程序中控制器动作中的“应用程序" [英] Having to explicitly render :layout => 'application' in controller actions in my Rails 3 app
问题描述
我必须在控制器操作中显式呈现:layout =>'application',才能使新的Rails 3应用程序实际使用application.html.erb布局文件.
I am having to explicitly render :layout => 'application' in my controller actions in order to get my new rails 3 app to actually use the application.html.erb layout file.
有什么明显的事情要找我做错了吗?如果我不调用:layout选项,它将不会渲染布局.我收到类似这样的消息:
Any obvious things to look for that I am doing wrong? If I don't call the :layout option it just doesn't render the layout. I get a message like:
通过FooController#index以HTML格式处理
Processing by FooController#index as HTML
...当我在WEBrick上读取终端窗口跟踪时
...when I read the terminal window trace on WEBrick
推荐答案
从Rails 2.3.8升级到3.0.3的应用程序遇到了同样的问题.就我而言,除一个控制器外,所有控制器均已使用app/views/layouts/application.html.haml正确渲染.当我最后添加render :layout => 'application'
时,不合格的控制器正确呈现.
I experienced the same problem with an app upgraded from Rails 2.3.8 to 3.0.3. In my case, all controllers except one rendered properly with the app/views/layouts/application.html.haml. When I finally added render :layout => 'application'
, the non-conforming controller rendered properly.
这篇关于必须显式呈现:layout =>我的Rails 3应用程序中控制器动作中的“应用程序"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!