Ruby on Rails Sunday, February 27, 2011

On Feb 27, 7:56 pm, Erwin <yves_duf...@mac.com> wrote:
> this is to be used with MongoID as a criteria
>
> criteria.where(:tags => { "$in" => [tags[0]], "$in"
> =>[tags[1]] }).to_a
>
> any suggestion with json structure ?
>

You can't repeat keys in a json hash either. What are you actually
trying to do?

Fred

>
> On 27 fév, 19:47, Frederick Cheung <frederick.che...@gmail.com> wrote:
>
>
>
> > On Feb 27, 6:29 pm, Erwin <yves_duf...@mac.com> wrote:
>
> > > given an Arra tags[]
>
> > > I need to produce a resulting Hash as following ..
>
> > > { "$in" => [tags[0]], "$in" =>[tags[1], ...}
>
> > > in which the key should be always the same and the value being an
> > > Array
>
> > By definition, a hash stores a single value for a given key. The
> > closest you'll get is to make the value an array of all the things for
> > the key in question.
>
> > 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment