Walter Davis wrote in post #1147032:
> Think of the array of elements as the first variable passed to the
> method. You can have three or more elements in that array, if that's how
> deep the nesting goes.

Well, this part I understand; it's just the usual parameter passing, and 
of course you can pass any parameter (and, actually, it is the second 
parameter, not the first, but this is a minor issue). But ...
> But the array itself is the first variable, and
> in that limited way of looking at this, means that the documentation is
> correct to a point.

... I don't quite agree. Looking at the description of the possible 
signatures, the documentation says:

=====

link_to(body, url, html_options = {})
# url is a String; you can use URL helpers like
# posts_path

link_to(body, url_options = {}, html_options = {})
# url_options, except :method, is passed to url_for

link_to(options = {}, html_options = {}) do
  # name
end

link_to(url, html_options = {}) do
  # name
end

=====

In our case, the first of the signatures applies for our nested routes 
example (because all the other ones have a hash at the second 
parameter), and the *description* for it says: "url is a String". I 
thing this should be instead "url is a String or an object or an Array 
of objects, and the objects should be a subtype of ActiveRecord::Base". 
Do you think this would catch it? If not, it means that I'm still 
lacking some point of understanding here.

> I agree, it would be good if there was a signature
> showing this in the API docs. Good thing that Rails is open source --
> you can get a commit out of this if you write it up and submit a pull
> request on GitHub!

Maybe I would better submit a correction to the docs to the email 
address mentioned at the bottom of the apidock.com page. I'm still 
pretty new in the development with Rails, as you certainly have noticed, 
and at this stage, "fixing" something - even if it is only in the docs - 
could do more harm than good.

Ronald

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/10eb24292e5e093baaeb57938e8a727e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to