Reputation: 1439
I have a bunch of generated links created by
<% @location.exits.each do |e| %>
<%= link_to e.name, go_to_path(e) %><br/>
<% end %>
which goes to: get 'go_to' => 'adventure#goto'
in routes.rb
which links back to:
def goto
current_user.location_id = params[:id]
render 'index'
end
However, when clicking on any of the links, it leads me to the url: http://localhost:3000/go_to.2
instead of say http://localhost:3000/go_to/2
Not sure what I'm doing wrong here or how to fix it.
Upvotes: 0
Views: 59
Reputation: 44380
Fix you route to:
get 'go_to/:id' => 'adventure#goto'
Read about routes in Rails and the-query-string
Upvotes: 3