我有一个问题:如何在滤波器参数中写出2个条件? :page_path.eql => "/teams/1" or :page_path.eql => 'teams/2'
它适用于一种情况,但不适用于两种情况:(
output = Exits.results(profile, :filters => {:page_path.eql => "/teams/1"})
答案 0 :(得分:0)
试试这个
output = Exits.results(profile,:filters =>{:page_path.contains => "^/teams/[1|2]$"})
您也可以尝试速记
output = profile.exits(:filters =>{:page_path.contains => "^/teams/[1|2]$"})
包含日期选项
output = Exits.results(profile, :filters => {:page_path.contains => "^/teams/[1|2]$"},:start_date => Date.new(2012,8,13),:end_date => Date.today)
或
output = profile.exits(:filters => {:page_path.contains => "^/teams/[1|2]$"},:start_date => Date.new(2012,8,13),:end_date => Date.today)
这对我有用
使用contains
代替matches
我认为它不了解正则表达式。