简体   繁体   English

ActiveAdmin:date_range筛选器类型导致undefined_method错误(MetaSearch)

[英]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. 我正在实现ActiveAdmin,并且想在Job表的date列上使用:date_range过滤器类型。 According to the documentation this just needs to be set as filter [:attr], :as => :date_range . 根据文档,只需将其设置为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 ! 在Google中搜索此错误绝对不会产生任何结果 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. 我正在使用ActiveAdmin的0.6.3版本,并且根据ActiveAdmin文档在我的Gemfile用于gem "meta_search", '>= 1.1.0.pre'

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: 如果您的模型/资源包括日期属性(when_datetime),则只需向页面添加以下代码段:

filter :when_datetime

if the when_datetime has a date type, the filter is going to be a date_range by default. 如果when_datetime具有日期类型,则默认情况下,过滤器将为date_range

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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