form_for behavior


A couple of related questions...

On p334 of The Rails 3 Way there's an example that looks like this:

form_for :client, person, :url => {:action => "update"} do |f|

which it is claimed allows you to use a different name, 'client' for
person in the params hash.

I haven't been able to get this to work, however in looking at the API
documentation here:

I see an example that uses a different syntax, like this:

form_for(@person, :as => :client) do |f|

which does work for me as advertised.

However I also see that the Rails 2.3.8 documentation does have an
example with the first syntax, which makes me think the API was
changed, though I haven't been able to find any explicit discussion of
this anywhere. Curiously, my experimentation finds that the original
syntax still works on fields_for.

Can someone confirm for me that the example in TR3W is wrong and that
the syntax for form_for was changed in 3.x, but not for fields_for. If
that is so, what is the rationale for using different approaches in
the two different methods?

Second question... on p337 there's an example that looks like this:

form_for "person[]" do |f|

which is intended to generate id-indexed attribute keys in the params
hash. Again, this doesn't work for me, for I think the same reason as
above. It seems like the right way to do this would to create the form
with the form_tag helper and then use

fields_for "person[]" do |f|

Again can someone please confirm for me that TR3W is wrong here.

Thanks for any help.