Resolving named route conflicts

Let's say you're building a movie rental website. You have customers, movies, and rentals to manage. REST style urls might look like this:

/customers/4 /movies/15 /rentals

You'd probably also want administrators to be able to view all of the rentals done by a particular customer, and other similar details:

/customers/4/rentals /movies/15/rentals /rentals/529/customers

Except you can't, at least not as far as I understand route generation. Looking at routes.rb for the example:

  map.resources :movies do |movies|     movies.resources :rentals   end

  map.resources :rentals do | rentals|     rentals.resources :customers   end

  map.resources :customers do |customers|     customers.resources :rentals   end

These map blocks introduce ambiguity about what rental_url(1,5) should generate - /movies/1/rentals/5 or /customers/1/movies/5. The error message pointing this out sucks (rentals_url failed to generate from {:controller=>"rentals", :action=>"index"}, expected: {:controller=>"rentals", :action=>"index"}, diff: {}), but I digress.

Instead of throwing an error in this kind of situation (which I imagine would be relatively common), why not take a named route like customer_rentals_url(1,5) or new_movie_rental_url(1)?

There may be a very good reason why not, and I'm new here, so bear with me. :slight_smile: