繁体   English   中英

使用ransacker的数字自定义过滤器不起作用

[英]Numeric custom filter with ransacker is not working

我正在尝试在Rails应用程序的ActiveAdmin中创建新的自定义过滤器。 当我输入下面的代码

filter :premium_scenes_in

它将输入字段显示为文本输入字段(带有选项“包含”,“等于”等),但我希望输入字段为带有选项“等于”,“大于”或“小于”的数字。

我尝试使用:

filter :premium_scenes_in, as: :numericfilter :premium_scenes_in, as: :numeric_range

但是每次显示错误时Unable to find input class NumaricRangeInput

这是我在模型中的代码

ransacker :premium_scenes,
  formatter: proc { |number|
    results = Tour.all.map{|tour| tour if tour.scenes.count > number}
    results = results.present? ? results : nil
   }, splat_params: true do |parent|
  parent.table[:id]
end

我认为您的意思as: :number 支持的输入类型在此处Formtastic自述文件中进行了说明

暂无
暂无

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

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