This project is archived and is in readonly mode.
Fix url_for(nil) crashing
Reported by Cheah Chu Yeow | June 23rd, 2008 @ 02:02 PM
url_for(nil)
will be inferred as the nil_class_url named route - which doesn't exist 99% of the time causing an uncaught exception.
I wasn't trying to use this, just noticed the url_for helper method actually did accept a nil option while reading documentation:
when NilClass
url = @controller.send(:url_for, nil)
I looked back at http://dev.rubyonrails.org/ticke... and I made a guess that the best way to respond to a nil argument is to assume you want the current url.
Patch attached.
Comments and changes to this ticket
-
Repository July 9th, 2008 @ 01:25 PM
- State changed from new to resolved
- Tag set to actionpack, patch, tiny
(from [96708af6a58a48c2324a3bf8d34232bc29b398c9]) Ensure url_for(nil) falls back to url_for({}). [#472 state:resolved]
Signed-off-by: Pratik Naik
-
Repository August 25th, 2008 @ 09:27 AM
(from [4fa6615b15451fcdea17b33ebd78e3f4a848e4e7]) Ensure url_for(nil) falls back to url_for({}). [#472 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 472 Fix url_for(nil) crashing (from [4fa6615b15451fcdea17b33ebd78e3f4a848e4e7]) Ensure ...