Ronald Fischer
2014-May-23 09:35 UTC
link_to with array parameter for URL : What does it mean?
(Crossposting Note: This topic has been posted already at
https://railsforum.com/topic/1933-link-to-with-array-parameter-for-url-what-does-it-mean
, but did not get a reply so far)
I found in http://guides.rubyon...-a-partial-form the following example:
link_to 'Destroy Comment', [comment.article, comment], method: :delete,
data: { confirm: 'Are you sure?' }
I was surprised to see an array as second parameter for link_to and
would like to know the meaning of this construct. The website gives just
the somewhat thin explanation Clicking this new "Destroy Comment" link
will fire off a DELETE /articles/:article_id/comments/:id to our
CommentsController, which explains the effect of this statement, but
does not really explain the general mechanism behind this concept. I've
looked up the API documentation at http://api.rubyonrails.org/, which
gives for the second parameter of link_to the following choices (for the
case that the first parameter is a string):
A string containing the URL to link to, or
A hash containing various options for the URL
An array as parameter is not mentioned. It seems that the API
documentation is not complete here. Or did I look at the wrong place?
Please could someone explain this syntax to me, and also point out,
where I can find a more detailed description of the API?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/778fe1221ef4104cc28d0909c40fd1c1%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.