Hacker News new | ask | show | jobs
by mattgreenrocks 5163 days ago
You should be using resource-based routes if you've already got the RESTful controller thing going.

The match statement is good for the occasional odd cases, but it has an :via option that can be used to restrict which HTTP actions it is allowed to match.

Edit: corrected below...thanks!

1 comments

Fix - not :as but :via. Using match :via => :post is worse than just post 'data', it is obvious btw :)

and there are almost no odd cases in fact. I would propose special route named "not_found" or "default" like route to be called if no routes found. Nice idea IMO, what do you think?

Thanks, it is early :)

I had to use match when moving from Rails 2 to Rails 3 and parts of the route did not match the controller at all. But I think it was mostly because the upgrade plugin recommended it.