Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch to deal with named_route name collisions... #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rst
Copy link

@rst rst commented Oct 18, 2010

Updating my app, I discovered that 'map.resources :requests' breaks recent
versions of resources_controller --- this defines a 'request_path' named route,
which in turn winds up clobbering resources_controller's internal method by
that name.

This is a patch to deal with the issue, by renaming the method to
'path_of_request', which takes it out of the line of fire. Most of it is
updating the specs (which all still pass... at least after a 'mkdir tmp'
so it could create the sqlite3 test db).

FWIW, this is currently lighthouse ticket #9:

http://ianwhite.lighthouseapp.com/projects/10598/tickets/9-request_path-method-gets-clobbered-by-named-routes

Resources_controller defined an internal controller method called
'request_path'.  If you've got a 'map.resources :requests' in your
routes.rb file, that defines a named route called 'request_path'.
When these two meet... wackiness ensues!

To avoid the wackiness (which manifests as complaints from the
code that implements the named route), this patch renames the
'request_path' method, and its companion 'nested_request_path',
so that they're no longer at risk of being trampled by eccentric
named routes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant