Alex
Alex

Reputation: 36111

Rails routing: id doesn't work

I have the following routing rule:

match ':controller/:action/:id'

However when I use

<%= link_to "Link", :action => "some_action", :id => 10 %>

Instead of redirecting to "some_action/10" it redirects to "some_action?id=10"

How can I fix that?

P.S. I know I should be using the path methods, but is there a way to avoid them?

Upvotes: 0

Views: 173

Answers (1)

Thilo
Thilo

Reputation: 17735

As Matchu said, it should work. Try making your catch-all route the first one in routes.rb. If it works then, you'll know there's another route being evaluated first.

If this doesn't work, post your complete routes.rb file.

Upvotes: 1

Related Questions