0

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.

0

1 Answer 1

3

Fix you route to:

get 'go_to/:id' => 'adventure#goto'

Read about routes in Rails and the-query-string

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.