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/d1a192fbe2919497/ec18932cddb9f86d?lnk=gst&q=field+array#ec18932cddb9f86d
> - Datamapper thread:
> http://groups.google.com/group/datamapper/browse_thread/thread/3dd67743015fa46c/6c806cc72036a3df?lnk=gst&q=george+adamson#6c806cc72036a3df
>
> 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 at 
> http://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