On Oct 6, 5:09 pm, Walter Lee Davis <[email protected]> wrote:
> On Oct 6, 2011, at 11:59 AM, Walter Lee Davis wrote:

> >> is a more convenient way of writing link_to 'text',
> >> polymorphic_path(blah) or link_to 'text', blah_path(blah) (assuming
> >> you have resources :blahs).
> >> Both of those two _path helpers should allow you to specify extra
> >> options (i.e. polymorphic_path(blah, :page => 2))
>
> > So are you saying that if I'm in the application helper, I can use a 
> > polymorphic_path, even though I am not declaring anything to be 
> > polymorphic? That's a new one on me.
>
> Refactored, works great! Thanks!

polymorphic_path is a rails provided method - it's what gets called by
rails when you shorthand stuff like form_for(some_object) or link_to
'blah', some_other_object. It basically just looks at the class name
(probably via the activemodel::naming) stuff and then calls the
explicit path helper (comment_path etc) that it expects to exist given
what you're asking it to do.

Fred

-- 
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 this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to