无法在 Rails 3 中渲染布局 [英] Can't render layout in rails 3

查看:27
本文介绍了无法在 Rails 3 中渲染布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个为 rails 2 编写的应用程序.我要升级到 rails 3.我的应用程序的大部分功能都可以工作,但它不呈现任何布局.我正在使用默认的erb"引擎.

I have an application which was written for rails 2. I'm upgrading to rails 3. Most of the functionality of my app works but it does not render any layout. I'm using default 'erb' engine.

我已经在我的控制器中明确调用了一个布局,但它甚至不渲染最简单的布局

I've explicitly called a layout in my controller but it just does not render even the simplest layout

layout 'application'

它不会抛出任何错误.

当我创建一个新项目并尝试在其中渲染布局时,它运行良好.

When I create a new project and try to render a layout in it, it works perfectly.

推荐答案

你必须使用

render :layout => 'application'

你可以在这里查看:

http://guides.rubyonrails.org/layouts_and_rendering.html

希望这会有所帮助!

这篇关于无法在 Rails 3 中渲染布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆