Louis Morin
Louis Morin

Reputation: 149

SyntaxError - syntax error, unexpected ':' class:

I am getting the following syntax error:

SyntaxError - syntax error, unexpected ':'
            class: "glyphicon glyphicon-chevron...
                  ^:

This is my code. I am not sure what is going on....

% if policy(Vote.new).create? %>
    <div class="vote-arrows pull-left">
    <div>
        <%= link_to " ",
            post_up_vote_path(post);
            class: "glyphicon glyphicon-chevron-up #{(current_user.voted(post) && current_user.voted(post).up_vote?) ? 'voted' : '' }" %>
    </div>
    <div>
        <strong><%= post.points %></strong>
    </div>
    <div>
        <%= link_to " ",
            post_down_vote_path(post),
            class: "glyphicon glyphicon-chevron-down #{(current_user.voted(post) && current_user.voted(post).down_vote?) ? 'voted' : '' }" %>
    </div>
</div>
<% end %>

This is my ruby version: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]

Upvotes: 0

Views: 138

Answers (1)

Dave Newton
Dave Newton

Reputation: 160191

You have a spurious semicolon in the middle of your link_to call:

    <%= link_to " ",
        post_up_vote_path(post); # <=== wat
        class: "glyphicon glyphicon-chevron-up #{(current_user.voted(post) && current_user.voted(post).up_vote?) ? 'voted' : '' }" %>

Upvotes: 2

Related Questions