For a permissions system i'm writing i'm extending the standard link_to
helpers to check if a user has a permission to perform that action
before displaying a link to clean-up my code so i don't have to put if
checks all over them.
I'm trying to use..
ActionController::Routing::Routes.recognize_path(url, :method => method)
to get the action and controller out so i can check those permissions.
The problem im having is when it comes to more complicated routes the
recognize_path method gets things mixed up e.g.
/admin/users/60/edit - Controller: admin/users | Action: 60 | Id: edit -
/admin/users/60 - Controller: admin/users | Action: destroy | Id: 60 -
/admin/users/60/ban - Controller: admin/users | Action: 60 | Id: ban -
As you see the ban link has the action and id the wrong way round.
Is there a correct way around this rather than just swapping the 2
Also when doing a nested route like....
It errors saying "Only get, put, and delete requests are allowed." even
though that route works perfectly fine in a view.
The projects currently running on rails 2.0.1 if that helps.