2

I have a route like get "/schools/:id/:sport_name" => "schools#show", but when I run school_path(School.first, sport_name: "football"), the route generated is http://localhost:3000/schools/slug-name-here?sport_name=football...

I thought you could pass in the matched parameter name and the URL generator would build the URL based on the options set. May just be having a "case of the mondays", but I am not sure what I am doing wrong.

1
  • 2
    school_path(School.first, 'football', other_options:'here') Commented Oct 15, 2013 at 17:28

1 Answer 1

2

Try to simply do:

school_path([School.first, 'football'])

Any other params you add at the end like so:

school_path([School.first, 'football'], foo: :bar)

Will be passed as http://localhost:3000/schools/football?foo=bar

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

1 Comment

Try: school_path([School.first, 'football'])

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.