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.
On Sep 3, 2:05 pm, John Merlino <[email protected]> wrote: > 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.

