2011-06-24 26 views
0

我使用的Ruby on由邁克爾·哈特爾Rails的教程 - 第8章 - Rails 3的紅寶石第8章教程部分文件

在文件new.html.erb我:

<h1>Sign up</h1> 

<%= form_for(@user) do |f| %> 
<%= render 'shared/error_messages' %> 

我創建該文件的應用程序/視圖/共享/ _error_messages.html.erb

當我運行測試:束EXEC rspec的投機/請求/ users_spec.rb我收到以下錯誤消息:

失敗:

  1. 用戶註冊失敗不應該讓新用戶

    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" 
    
  2. 用戶立即登記成功應該讓新用戶

    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" 
    
+0

如果你用'<%= render'/ shared/error_messages'%>替換,那該怎麼辦?' – apneadiving

+0

這沒有用。我使用AptanaStudio3作爲我的編輯器,並且一旦我保存了該文件,就出現了以下錯誤:/ Aptana Studio 3/configuration/org.eclipse.osgi/bundles/84/1/.cp/bundles/rails.ruble/commands/content_assist.rb:7) \t at org.jruby.RubyProc.call(org/jruby/RubyProc.java:268)仍嘗試過運行rspec,並得到相同的錯誤 – user814455

+0

真的很奇怪,沒有其他的想法,然後 – apneadiving

回答

1

感謝apneadiving。當我去到文件夾app/views/shared並且執行了ls命令時,它在那裏顯示了文件。但是,當我試圖捕捉文件時,它找不到文件。做一個ls -al顯示文件有一個@用於額外的屬性。我在我的編輯器中加載了該文件並將其另存爲另一個名稱。然後重新創建原始文件並刪除舊文件。一切都奏效了。