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.

Routes problem

#1856

Hi,

I have namespace admin in my app:


map.namespace(:admin) do |admin|
  admin.resources :articles
  #.... more admin routes
end

After changing rails version to 2.3.0 I've got "No action responded to 1" error while trying to GET "/admin/opinions/1".

Reported by Piotr Sarnacki · February 3rd, 2009 @ 10:36 AM

State: wontfix
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Rocco Di Leo
    Rocco Di Leo

    I have the same problem.

    The rake routes command shows a correct definition:

    clubs GET /clubs/:id/(.:format) {:action=>"show", :controller=>"clubs"}

    This call will result in a "No action responded to the-club-to-view"-error:

    http://localhost/clubs/the-club-...

    This call works:

    http://localhost/clubs/show/the-...

    Greets Rocco

    February 3rd, 2009 @ 12:51 PM

  2. Rocco Di Leo
    Rocco Di Leo

    In addition to this problem .. nested routes do not work either:

    map.resource :cms do |sub|

    sub.resources :categories
    
    

    end

    calling /cms/categories in the browser results again in a "No action responded to categories"

    Greets Rocco

    February 3rd, 2009 @ 01:08 PM

  3. Pascal Ehlert
    Pascal Ehlert

    Is there any chance that you have the desert plugin installed?

    February 3rd, 2009 @ 01:48 PM

  4. Rocco Di Leo
    Rocco Di Leo

    no, i have not installed the desert plugin.

    February 3rd, 2009 @ 02:34 PM

  5. DHH
    DHH
    • Milestone cleared.
    • Assigned user set to josh

    February 3rd, 2009 @ 04:32 PM

  6. josh
    josh
    • State changed from new to wontfix

    Unable to reproduce with a fresh rails app.

    Can you please create a reproducible unit tests against the actionpack tests.

    February 3rd, 2009 @ 11:28 PM

  7. Rocco Di Leo
    Rocco Di Leo

    I can reproduce the problem on Mac Os X 10.5.6 with a fresh rails 2.3.0 application by doing:

    Create a new app with one resource

    rails testapp ... cd testapp script/generate controller clubs (adding map.resources :clubs to routes.rb) rake routes

    *Correctly outputs the generated resources:*

    clubs GET /clubs(.:format) {:action=>"index", :controller=>"clubs"}

          POST   /clubs(.:format)                   {:action=>"create", :controller=>"clubs"}
    
    

    new_club GET /clubs/new(.:format) {:action=>"new", :controller=>"clubs"} edit_club GET /clubs/:id/edit(.:format) {:action=>"edit", :controller=>"clubs"}

     club GET    /clubs/:id(.:format)               {:action=>"show", :controller=>"clubs"}
          PUT    /clubs/:id(.:format)               {:action=>"update", :controller=>"clubs"}
          DELETE /clubs/:id(.:format)               {:action=>"destroy", :controller=>"clubs"}
                 /:controller/:action/:id           
                 /:controller/:action/:id(.:format) 
    
    

    Let's test the route in the Console

    ./script/console Loading development environment (Rails 2.3.0) >> rs = ActionController::Routing::Routes ... >> rs.recognize_path('/clubs') => {:action=>"index", :controller=>"clubs"} <- Okay! >> rs.recognize_path('/clubs/1') => {:action=>"1", :controller=>"clubs"} <- NOT okay! action should be "show" and i miss the :id => 1

    Hope this helps.

    Greets -act

    February 4th, 2009 @ 06:24 AM

  8. Rocco Di Leo
    Rocco Di Leo

    Sorry, the Formatting is quiete bad in the last post (preview option would be great here :) )

    Anyways, when generating a new rails app with 2.3.0, generating a controller and adding it's resource in routes.rb and then trying to validate the route in the console, i get the same wrong result (/clubs/1 routes to :controller => clubs with :action => 1 instead of :controller => clubs, :action => 'show' and :id => 1

    greets -act

    February 4th, 2009 @ 06:27 AM

  9. Rocco Di Leo
    Rocco Di Leo

    And a final note .. the recognition in the console works when invoking the command with an additional method-option:

    rs.recognize_path('/clubs/1', :method => :get) => {:action=>"show", :controller=>"clubs", :id=>"1"}

    rs.recognize_path('/clubs/1') => {:action=>"1", :controller=>"clubs"}

    I thought that :get is magically called when ommitting.

    greets -act

    February 4th, 2009 @ 06:36 AM

  10. Rocco Di Leo
    Rocco Di Leo

    okay, forget all my last three postings. i basically just proved that indeed the routing works with a fresh rails 2.3.0 installation. Doesnt solve my problem with my updated application but i guess you can close the ticket after all, since it seems to be an individual applcation problem on my side.

    final greet :) -act

    February 4th, 2009 @ 06:42 AM

  11. Rocco Di Leo
    Rocco Di Leo
    • Assigned user cleared.

    for those interested .. i located the problem. The rails plugin "smurf" (a js/css-Minifier) was the reason that the routing broke in Rails 2.3.0 for me.

    After removal, the routing worked as expected.

    I have not taken a too closer look at its code, but just in case you happen to have the same problem, check your installed plugins one by one.

    The plugin can be found for audit at http://github.com/thumblemonks/s...

    Greets Rocco

    February 4th, 2009 @ 08:10 AM

  12. Gus
    Gus

    actraiser,

    I just saw this ticket. On 2/16, I made changes to smurf to fix something identified by cainlevy. I'm also using smurf with Rails 2.3.1 right now without any problems. If you would like to, please get the latest smurf and try again. Let me know if there are any more problems.

    • gus (aka a thumble monk)

    March 8th, 2009 @ 11:25 PM