Forum: Ruby on Rails Receiver for *_path or *_url

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
docpneumo (Guest)
on 2009-05-08 01:29
(Received via mailing list)
I'm trying to find out the receiver for *_path messages as in:
      link_to 'Show', product_path(@product)

This came up when I moved the creation of view fragments into objects
(RColumn) intended to encapsulate the view behaviors of the various
fields in a record as part of an exploration of dynamic scaffolding
(e.g. streamlined). Those objects do not have a product_path() method,
of course. I thought at first that the controller using the RColumns
within a view would be the receiver, but that appears to not be true.
I suspect the receiver is a routing mapper object but do not know how
to make that object available for use in my RColumn.

BTW. The alternate form:
                link_to 'Show', { :controller => 'products', :action
=> 'show', :id => }
          works in the RColumn context.

Any suggestions?

Doc Pneumo
docpneumo (Guest)
on 2009-05-08 02:19
(Received via mailing list)
Perhaps to clarify: I realize that what ever happens to be self
whenever the method is encountered is sent the message in the examples
I posted. I'm looking for the intended receiver so that I can use
something like:

      link_to 'Show', recvr.product_path(@product)

in my RColumn instances.
This topic is locked and can not be replied to.