searchlogic icon indicating copy to clipboard operation
searchlogic copied to clipboard

Chain scopes with "and"

Open javierm opened this issue 15 years ago • 0 comments

Let's say I've got a list of events. I want to find out which events were active at a certain date. So I run:

Event.start_date_lte('2010-01-01').end_date_gte('2010-01-01')

And everything works fine.

Now I'd like to use a form so the user can enter the date, and I'd like to generate this search using just one input field. So it would be nice if I could just do:

Event.start_date_lte_and_end_date_gte('2010-01-01')

Just the same way the same it is possible with 'OR'.

If you find it useful, consider implementing it in the future.

Thanks.

javierm avatar Feb 18 '10 07:02 javierm