@Gregory, thanks for the response. I haven't yet tried it, but should
it be
@flower = Flower.create(:colors => ['red', 'blue', 'green'])
Flower.where(:
colors.in => ['red']) #=> returns the same record as
@flower
@JDeville and @Gregory
I am probably wrong about this, though the syntax ".in" seems to me to
be query "Find all flowers the values of whose colors field are a
subset of _____"
For example, should the above query Flower.where(:
colors.in =>
['red']) mean find all flowers which have the colors field to be in
the set ['red']?
On Sep 10, 8:38 am, Gregory Moeck <
gmo...@gmail.com> wrote:
> Forgot to include Mongoid::Document in the class there :)
>
> On Fri, Sep 10, 2010 at 8:37 AM, Gregory Moeck <
gmo...@gmail.com> wrote:
> > Try:
>
> > Class Flower
> > field :colors, :type => Array
> > end
>
> > Color.create(:colors => ['red', 'blue', 'green'])
>
> > Color.where(:
colors.in => ['red'])
>