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.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to