我正在通过railtutorial.org在线书籍中找到rails 3.我已经完成了第11章的大部分内容,我们在其中添加了提交微博的功能.添加适当的代码后,我无法呈现页面.以下是返回的错误:
>
Pages#home中的NoMethodError
显示c:/rails_projects/sample_app/app/views/shared/_error_messages.html.erb,其中>#1行:
当你没想到它时,你有一个零对象!您可能期望ActiveRecord :: Base的实例.在评估nil.errors提取的源(第1行附近)时发生错误:
1:
<% if @user.errors.any? %>
2:<div id="error_explanation">
3:<h2><%= pluralize(@user.errors.count, "error") %>
4:prohibited this <%= object.class.to_s.underscore.humanize.downcase %>
模板包含的跟踪:app/views/shared/_micropost_form.html.erb,> app/views/pages/home.html.erb
如果我从app\views\shared_micropost_form.html.erb <%= render'shared/error_messages',:object => f.object%>中删除以下行,页面将正确呈现
任何帮助表示赞赏.
我正在使用Selenium并且有测试随机选择他们运行的浏览器.我有一些测试测试与国际化相关的功能,所以我需要让浏览器指定浏览器语言.
我最好的猜测是我需要使用SetCapability方法作为DesiredCapabilities类的一部分,但我不确定哪些功能可以设置.