我正在尝试将class
属性应用于link_to
块。在此SO帖子之后:Adding a class to link_to block
我写道:
=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
答案 0 :(得分:1)
删除路径周围的括号......
=link_to who_we_are_path, class:'top-nav-anchor' do
WHO WE ARE
.glyphicon.glyphicon-plus