Question

I tried doing several searches for this and couldn't find anything, so hopefully I'm not posting a duplicate.

So, the API Dock's link_to docs has this as a signature:

link_to(options = {}, html_options = {}) do
  # name
end

Seemed kind of interesting so I decided to give this a shot:

<%= link_to { action: 'win', game_id: @games[0].id }, { :method => :post } do %>
  <div>
    <%= image_tag @games[0].img_url %>
    <%= @games[0].name %>
  </div>
<% end %>

This resulted in a syntax error in the first line:

syntax error, unexpected ':', expecting '}'
...ffer.append=  link_to { action: 'win', game_id: @games[0].id...

I also tried it with parentheses:

<%= link_to ({ action: 'win', game_id: @games[0].id }, { :method => :post }) do %>

This also gave me a syntax error, same line:

syntax error, unexpected ',', expecting ')'
...'win', game_id: @games[0].id }, { :method => :post }) do @ou...

I've been looking at this for a while and I figure it's something simple I missed, but if anyone has any idea, I'd really appreciate it!

Thanks!

Was it helpful?

Solution

Silly me! It was the space between the link_to and the (...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top