Ruby on Rails 3中,如何定义或引入未定义的局部变量或方法`render`?
- 内容介绍
- 文章标签
- 相关推荐
本文共计350个文字,预计阅读时间需要2分钟。
我的rspec代码中出现了以下错误:+undefined local variable or method `render'。这是我的代码片段:
rubyrequire 'spec_helper'describe messages/show..erb do it displays the text attribute of the message do render rendered.should contain text attribute endend
错误提示表明`render`方法未定义。请确保在测试中正确调用`render`方法,或者如果你不需要手动调用,可以移除`render`行。
本文共计350个文字,预计阅读时间需要2分钟。
我的rspec代码中出现了以下错误:+undefined local variable or method `render'。这是我的代码片段:
rubyrequire 'spec_helper'describe messages/show..erb do it displays the text attribute of the message do render rendered.should contain text attribute endend
错误提示表明`render`方法未定义。请确保在测试中正确调用`render`方法,或者如果你不需要手动调用,可以移除`render`行。

