【发布时间】:2011-06-24 17:34:53
【问题描述】:
我正在使用 Michael Hartl 编写的 Ruby on Rails 教程 - 第 8 章 - Rails 3
在文件 new.html.erb 我有:
<h1>Sign up</h1>
<%= form_for(@user) do |f| %>
<%= render 'shared/error_messages' %>
我创建了文件 app/views/shared/_error_messages.html.erb
当我运行测试时: bundle exec rspec spec/requests/users_spec.rb 我收到以下错误消息:
失败:
-
用户注册失败不应成为新用户
Failure/Error: visit signup_path ActionView::Template::Error: Missing partial shared/error_messages with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/username/rails_projects/my_sample_app/app/views" -
用户注册成功应该是新用户
Failure/Error: visit signup_path ActionView::Template::Error: Missing partial shared/error_messages with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/username/rails_projects/my_sample_app/app/views"
【问题讨论】:
-
如果换成
<%= render '/shared/error_messages' %>会怎么样 -
那行不通。我使用 AptanaStudio3 作为我的编辑器,一旦我保存文件,就会发生以下错误:/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/84/1/.cp/bundles/rails.ruble/commands/ content_assist.rb:7) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:268) 仍然尝试运行 rspec 并得到同样的错误
-
真的很奇怪,没有别的想法
标签: ruby-on-rails