4

My routes:

resources :events, :path_names => { :new => "organize" } do
    resources :forums
end

With these routes, I'll get urls like /events/:event_id/forums/organize. I don't want the path_names to propagate to my nested routes... Do I have to redefine path_names for them? Or use scope?

resources :events, :path_names => { :new => "organize" } do
    scope :path_names => { :new => "new" } do
        resources :forums
        # other nested resources...
    end
end

Or (my favorite, until you find a better solution ;))

resources :events, :path_names => { :new => "organize" }
resources :events, :only => [] do
    #nested resources...
end

Is there a more elegant way to do this? if you don't think so, you can also tell me which one is the best in your opinion.

Robin
  • 21,667
  • 10
  • 62
  • 85
  • What about defining `:path_names` for forums in the same way? – Sergio Tulentsev Jan 04 '12 at 03:18
  • That's an option, but not the best one I think. Because I have a lot of nested resources, not just forums. So worst case scenario, I would use the 2 other solutions. – Robin Jan 04 '12 at 03:22

1 Answers1

0

I went for the last option:

resources :events, :path_names => { :new => "organize" }
resources :events, :only => [] do
    #nested resources...
end
Robin
  • 21,667
  • 10
  • 62
  • 85