On Apr 15, 5:09 pm, PJ <camillieri...@gmail.com> wrote:
> Thanks Fred.
>
> Considering there is a bit of "wizardry" that needs to be done and
> that Rails doesn't include helpers to do this simply, does it mean it
> is not recommended to build such complex forms?
>
> I am not very experienced with Rails, but I love the fact it is very
> "clean" and I feel a bit cautious having to generate keys manually.
>
There is the nested forms stuff in rails 2.3 (unfortunately not yet
documented in the guide).
Fred
> PJ
>
> On Apr 15, 9:05 am, Frederick Cheung <frederick.che...@gmail.com>
> wrote:
>
> > On Apr 15, 1:07 am, PJ <camillieri...@gmail.com> wrote:
>
> > > "model_a[model_b_attributes][][model_c_attributes][][an_attribute]"
>
> > > But it doesn't seem to work. I read
> > > herehttp://guides.rubyonrails.org/form_helpers.html
> > > that "only one level of “arrayness” is allowed" and that I should use
> > > hashes instead, but I am not quite sure I understand how to do it.
>
> > > Do you have any idea?
>
> > What that comment is saying is that you can replace an array eg
> > [a,b,c] with a hash eg {1 => a, 2=> b, 3=>c}
> > Generating those keys is up to your client side code, approaches
> > included using a number you increment or going for some unique thing
> > you generate on the spot (eg time in milliseconds concatenated with a
> > random number) so that you don't have to keep track of how many fields
> > and what not you have created clientside.
>
> > 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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---