simple_enum icon indicating copy to clipboard operation
simple_enum copied to clipboard

Enum querying using "or" condition

Open hgani opened this issue 10 years ago • 2 comments

Hi,

Sorry if I've missed it but I haven't found any info for easily querying using "or" conditions.

Let say we have:

as_enum :status, { active: 0, pending: 1, declined: 11 }

And we want to query records that are either active or pending. It doesn't seem that there's a shortcut for doing this yet. I think this can be implemented as part of the solution suggested in https://github.com/lwe/simple_enum/issues/95

So, we can do something like the following:

Item.where_with_enum(status: [:active, :pending])

Thanks

hgani avatar Jul 02 '15 02:07 hgani

Good point, it indeed makes sense to support this and I think we would get support for this out of the box.

lwe avatar Jul 03 '15 06:07 lwe

I think this one can be associated to #95 and closed.

aledalgrande avatar Apr 11 '17 19:04 aledalgrande