RoutesProxy

when passing an array as first argument to form_for, polymorphic_url
checks if first index is an instance of
ActionDispatch::Routing::RoutesProxy:

def polymorphic_url(record_or_hash_or_array, options = {})
if record_or_hash_or_array.kind_of?(Array)
record_or_hash_or_array = record_or_hash_or_array.compact
if record_or_hash_or_array.first.is_a?
(ActionDispatch::Routing::RoutesProxy)
proxy = record_or_hash_or_array.shift
end
record_or_hash_or_array = record_or_hash_or_array[0] if
record_or_hash_or_array.size == 1
end

It later than calls a named route on routesproxy object if it is not
nil:

(proxy || self).send(named_route, *args)

What exactly is RoutesProxy?

The documentation does a terrible job at explaining it:

http://rubydoc.info/docs/rails/ActionDispatch/Routing/RoutesProxy

And at moment I’d prefer some feedback before digging into the source.

I would like to bump this. Simple question. When will the first
element of an array passed as first argument to form_for ever be an
instance of RoutesProxy? The rails source looks for this, so I am sure
someone out there has examples.