ActiveAdmin :date_range filter type causes undefined_method error (MetaSearch)

358 Views Asked by At

I am implementing ActiveAdmin and would like to use the :date_range filter type on my Job table's date column. According to the documentation this just needs to be set as filter [:attr], :as => :date_range. When I use this code I get the following error:

undefined method `when_datetime_gte' for #<MetaSearch::Searches::Job:0xda5b68c>

Searching this error in Google produces absolutely nothing! I am using version 0.6.3 of ActiveAdmin and have gem "meta_search", '>= 1.1.0.pre' for MetaSearch in my Gemfile per the ActiveAdmin docs.

Any idea what's going on??

1

There are 1 best solutions below

1
moorara On

If your model/resource includes a date attribute (when_datetime), you only need to add the following snippet of code to your page:

filter :when_datetime

if the when_datetime has a date type, the filter is going to be a date_range by default.