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.

Router feature request

#4353

It would be super fantastic if a route option like :path_base...

MyApp::Application.routes.draw do |map|
  resources :nodes, :path_base => 'n'
end

...resulted in routes like...

          GET    /n(.:format)          {:controller=>"nodes", :action=>"index"}
    nodes POST   /n(.:format)          {:controller=>"nodes", :action=>"create"}
 new_node GET    /n/new(.:format)      {:controller=>"nodes", :action=>"new"}
          GET    /n/:id(.:format)      {:controller=>"nodes", :action=>"show"}
          PUT    /n/:id(.:format)      {:controller=>"nodes", :action=>"update"}
     node DELETE /n/:id(.:format)      {:controller=>"nodes", :action=>"destroy"}
edit_node GET    /n/:id/edit(.:format) {:controller=>"nodes", :action=>"edit"}

Is there currently a way to do this?

Reported by ravinggenius · April 9th, 2010 @ 05:39 AM

State: resolved
Milestone: none
Assigned to: Mikel Lindsaar Mikel Lindsaar
Importance: Low

Activity

  1. Cesario
    Cesario

    Could you give a shot with ":as" ?

    MyApp::Application.routes.draw do |map|
      resources :nodes, :as => 'n'
    end
    

    April 9th, 2010 @ 08:28 AM

  2. ravinggenius
    ravinggenius

    I tried that; :as changes the helper methods, but not the URLs. Combining options works:

    resources :n, :controller => :nodes, :as => :nodes
    

    April 9th, 2010 @ 03:04 PM

  3. Ryan Bigg
    Ryan Bigg

    This can be closed now.

    April 10th, 2010 @ 08:26 AM

  4. Ryan Bigg
    Ryan Bigg
    • Assigned user set to Mikel Lindsaar

    April 10th, 2010 @ 08:26 AM

  5. Mikel Lindsaar
    Mikel Lindsaar
    • State changed from new to resolved

    OP has found a working solution.

    April 10th, 2010 @ 08:29 AM