2012-10-19 64 views
2

在我的本地環境中工作時得到一個錯誤,但推送到Heroku的完全相同的代碼工作得很好。有任何想法嗎?需要幫助瞭解這個錯誤 - Pages#中的SyntaxError顯示

下面是我嘗試訪問應用程序本地環境中的任何頁面時顯示的內容。

/Users/user/badger/app/views/shared/_navigation.html.haml:211: syntax error, unexpected keyword_do_block 
    /Users/user/badger/app/views/shared/_navigation.html.haml:213: syntax error, unexpected keyword_end, expecting ')' 
     end).to_s); _erbout.concat "\n" 
    ^
/Users/user/badger/app/views/shared/_navigation.html.haml:249: syntax error, unexpected keyword_do_block 
/Users/user/badger/app/views/shared/_navigation.html.haml:251: syntax error, unexpected keyword_end, expecting ')' 
    end).to_s); _erbout.concat "\n" 
    ^

提取的源(左右線#211):

208:   :erb 
209:   <% if @page and @page.categories_include("About") %> 
210:    <%= link_to item.name.capitalize, polymorphic_path(item.navigable), :class => "current" %> 
211:   <% else %> 
212:    <%= link_to_unless_current item.name.capitalize, polymorphic_path(item.navigable), do 
213:    link_to item.name.capitalize, polymorphic_path(item.navigable), :class => "current" 
214:    end %> 

回答

2

的問題是在這裏:

<%= link_to_unless_current item.name.capitalize, polymorphic_path(item.navigable), do 

正如你所看到的,你有do前一個逗號。你需要刪除這個逗號。

+0

更換哇。馬克斯,謝謝一堆。我和我的神經謝謝你。 –

1

見下面的鏈接是如何在逗號使用link_to_unless_current

link_to_unless_current

您的問題( '')做

<%= link_to_unless_current item.name.capitalize, polymorphic_path(item.navigable), do 

之前只是與

<%= link_to_unless_current item.name.capitalize, polymorphic_path(item.navigable) do