Thanks snusnu, that is indeed an excellent link.
Some very useful info there about arranging field name square-brackets
to receive the desired arrays and hashes etc.

I'm now ploughing on with my own controller-action code to handle an
array of checkboxes. As far as I can see, merb does not natively
handle multiple fields with the same name. Shame because I have a lot
of pages that include child fields.

Cheers,
George

On Dec 7, 2:18 pm, Martin Gamsjaeger <[email protected]> wrote:
> George,
>
> I will try to reply to your previous post to the list later, and I
> gotta admit I haven't got enough time now to think about your question
> in this thread. However, I found
>
> http://wonderfullyflawed.com/2009/02/17/rails-forms-microformat/
>
> to be a very nice article that explains how params should be
> constructed and sent, in case you want to work with nested model
> assignment. It's definitely worth a read, imho.
>
> cheers
> snusnu
>
> On Mon, Dec 7, 2009 at 15:07, George Adamson
>
> <[email protected]> wrote:
> > After some investigation it seems that submitted fields names are not
> > parsed as expected.
>
> > If the post includes more than one field with the same name, only one
> > of them (the latter) will be present in the params hash when the form
> > is submitted.
>
> > For example the request.raw_post may contain:
> > trip[countries][id]=1&trip[countries][id]=2&trip[countries][id]=3
>
> > ...but the params hash will only contain: "countries"=>{"id"=>"3"}
> > I would expect something like: "countries"=>[{"id"=>"1"}{"id"=>"2"}
> > {"id"=>"3"}]
> > (The Merb::Parse.query method seems to be responsible for this.)
>
> > Ideally merb would handle the update of trip.countries but at the very
> > least we should have an array of trip countries to loop through to
> > update the countries.
>
> > Is this a bug or have I misunderstood?
> > (The scenario is a bunch of checkboxes on a Trip page, allowing the
> > user to choose one or more countries. The Trip class "has
> > n, :trip_countries" and "has n, :countries, :through
> > => :trip_countries")
>
> > Here are links to related threads:
> > - Merb thread:
> >http://groups.google.com/group/merb/browse_thread/thread/d1a192fbe291...
> > - Datamapper thread:
> >http://groups.google.com/group/datamapper/browse_thread/thread/3dd677...
>
> > George
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "merb" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/merb?hl=en.
>
>

--

You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.


Reply via email to