This project is archived and is in readonly mode.
Defining routes with symbols failes
Reported by iGEL | July 24th, 2008 @ 04:13 PM | in 2.x
Creating routes with a symbol like this failes:
map.with_options :controller => "vip" do |vip|
vip.vip_index '/vip', :action => :index
end
Rails won't find the Method in the controller, but it will find the view! The fix is easy:
actionpack/lib/action_controller/base.rb:1161 (in Rails 2.1.0) must be changed from:
if self.class.action_methods.include?(action_name)
to:
if self.class.action_methods.include?(action_name.to_s)
Comments and changes to this ticket
-
iGEL October 5th, 2008 @ 06:17 PM
- Tag changed from 2.1, actionpack, routing to 2.1, actionpack, routing
Since I couldn't think of a way to test the solution described above, I found another one. The :controller and :action are now converted to a string, if they were a symbol before. Test is included.
-
Pratik January 5th, 2009 @ 06:31 PM
- Tag changed from 2.1, actionpack, routing to 2.1, actionpack, patch, routing
- Assigned user set to Michael Koziarski
-
CancelProfileIsBroken March 7th, 2009 @ 04:23 PM
Patch doesn't apply cleanly on current edge. Would be easy enough to fix up the patch, but...I don't think I see a good reason to do this. Not every API that accepts strings needs to automatically accept symbols in their place.
-
iGEL March 8th, 2009 @ 08:09 PM
Well, I don't need to define routes with symbols, but I think, if I cannot do so, there should be an exception or something. Rendering the view without executing the action is not an expectable behavior...
-
Michael Koziarski March 9th, 2009 @ 04:13 AM
I agree with mike that we shouldn't always make every api symbol or string agnostic. However the silent failure is a problem here.
Another comment is that looping over options is wasteul if you're only checking two values. You should just convert those two known keys.
-
CancelProfileIsBroken May 16th, 2009 @ 04:52 PM
- State changed from new to incomplete
Should resubmit with the requested changes if you still want this.
-
CancelProfileIsBroken August 6th, 2009 @ 02:39 PM
- Tag changed from 2.1, actionpack, patch, routing to 2.1, actionpack, bugmash, patch, routing
-
Rizwan Reza August 8th, 2009 @ 06:28 PM
not reproducible
-1 This is already fixed. Just checked in 2-3-stable and master.
-
Michael Koziarski August 9th, 2009 @ 03:55 AM
- State changed from incomplete to resolved
-
Michael Koziarski August 9th, 2009 @ 03:55 AM
- Tag changed from 2.1, actionpack, bugmash, patch, routing to 2.1, actionpack, patch, routing
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
- 2828 Routes with symbols produces a silent fail For more info see #692