简体   繁体   中英

ActiveAdmin :date_range filter type causes undefined_method error (MetaSearch)

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??

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM