2012-05-31 40 views
0

我是一個新手,我正在通過Hartl慢慢地工作。剛剛開始在Ch5上。到了5.1並將新的樣式代碼添加到application.html.erb中,並且我在瀏覽器中收到了「Static_pages#home中的NoMethodError」。Michael Hartl教程v。3.2第5.1章用戶中的NoMethodError#new Line 4

這裏的終端讀出:

Started GET "/static_pages/home" for 127.0.0.1 at 2012-05-31 14:02:03 +0100 
Processing by StaticPagesController#home as HTML 
    Rendered static_pages/home.html.erb within layouts/application (0.0ms) 
Completed 500 Internal Server Error in 6ms 

ActionView::Template::Error (undefined method `full_title' for #<#<Class:0x007f865b6a0160>:0x007f865b5faad0>): 
    1: <!DOCTYPE html> 
    2: <html> 
    3: <head> 
    4: <title><%= full_title(yield(:title)) %></title> 
    5: <%= stylesheet_link_tag "application", media: "all" %> 
    6: <%= javascript_include_tag "application" %> 
    7: <%= csrf_meta_tags %> 
    app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb__2520617125150382104_70107517560200' 


    Rendered /Users/Lagaspi/.rvm/gems/[email protected]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.6ms) 
    Rendered /Users/Lagaspi/.rvm/gems/[email protected]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms) 
    Rendered /Users/Lagaspi/.rvm/gems/[email protected]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (9.1ms) 

的static_pages_controller

class StaticPagesController < ApplicationController 

    def home 
    end 

    def help 
    end 

    def about 
    end 

    def contact 
    end 
end 

什麼都沒有成功完成Ch.3改變。所以我回去了,再次工作了第3章,所有的測試通過都是綠色的,所有的瀏覽器測試都OK,我跳回了第5章。將Hartls新代碼剪切並粘貼到views/layouts/application.html.erb中,保存該文件並獲得相同的No Method Error。

回答

1

它看起來像full_title幫手是在Chapter 4開頭正確引入的。

+0

謝謝,一定錯過了那一步!它的工作現在。 –

+0

然後你應該接受答案 – Askar

相關問題