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:


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


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

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

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

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: