On Mar 15, 2013, at 2:39 PM, Michael Grohn wrote:
> @Matt jones
>
> > I'd guess that it's because while the body is typically simple (a string or
> > variable), the second argument can also be a bunch of params for url_for:
> >
> > link_to 'thingy', :controller => 'wat', :action => 'huh', :protocol =>
> > 'wtf'
>
> There are 4 signatures for the link_to helper method:
>
> link_to(body, url, html_options = {})
> link_to(body, url_options = {}, html_options = {})
> link_to(options = {}, html_options = {})
> link_to(url, html_options = {})
>
> Your example would fit the second signature, which has no url argument, but a
> url_options hash instead. This is fine, options always go at the end of a
> method call.
>
> The first signature is the one that bothers me.
It's ultimately a matter of symmetry, especially when switching from a hash to
a URL helper:
link_to 'something', :controller => 'posts', :action => 'show', :id => id
becomes:
link_to 'something', post_path(id)
Requiring that the arguments trade positions between those two lines would be
seriously annoying.
BTW, the bikeshed should TOTALLY be painted blue. ;)
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.