-2
我試圖將class
屬性應用於link_to
塊。在此之後SO帖子:Adding a class to link_to block語法錯誤,意外=>,期待keyword_end haml_temp
我已經寫:
=link_to(who_we_are_path), :class => 'top-nav-anchor' do
WHO WE ARE
.glyphicon.glyphicon-plus
不過,我得到以下錯誤:
al/app/views/shared/_top_nav.html.haml:110: syntax error, unexpected =>, expecting keyword_end haml_temp = link_to(who_we_are_path), :class => 'top-nav-anchor' do
我得到使用新的語法相同的錯誤:
=link_to(who_we_are_path), class:'top-nav-anchor' do
WHO WE ARE
.glyphicon.glyphicon-plus
您刪除'('和')'...並嘗試 –
或者將':class'移動到圓括號內。並且不要盲目複製來自stackoverflow的隨機代碼(不先理解它)。 :) –