Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Defining routes with symbols failes

#692

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)

Reported by iGEL · July 24th, 2008 @ 04:13 PM

State: resolved
Milestone: 2.x
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. iGEL
    iGEL
    • 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.

    October 5th, 2008 @ 06:17 PM

  2. Pratik
    Pratik
    • Tag changed from 2.1, actionpack, routing to 2.1, actionpack, patch, routing
    • Assigned user set to Michael Koziarski

    January 5th, 2009 @ 06:31 PM

  3. Paweł Kondzior
  4. CancelProfileIsBroken
    CancelProfileIsBroken

    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.

    March 7th, 2009 @ 04:23 PM

  5. iGEL
    iGEL

    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...

    March 8th, 2009 @ 08:09 PM

  6. Michael Koziarski
    Michael Koziarski

    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.

    March 9th, 2009 @ 04:13 AM

  7. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to incomplete

    Should resubmit with the requested changes if you still want this.

    May 16th, 2009 @ 04:52 PM

  8. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from 2.1, actionpack, patch, routing to 2.1, actionpack, bugmash, patch, routing

    August 6th, 2009 @ 02:39 PM

  9. Rizwan Reza
    Rizwan Reza

    not reproducible

    -1 This is already fixed. Just checked in 2-3-stable and master.

    August 8th, 2009 @ 06:28 PM

  10. Arthur Zapparoli
    Arthur Zapparoli

    not reproducible

    -1 it works on 2-3-stable

    August 9th, 2009 @ 03:53 AM

  11. Michael Koziarski
    Michael Koziarski
    • State changed from incomplete to resolved

    August 9th, 2009 @ 03:55 AM

  12. Michael Koziarski
    Michael Koziarski
    • Tag changed from 2.1, actionpack, bugmash, patch, routing to 2.1, actionpack, patch, routing

    August 9th, 2009 @ 03:55 AM