我有一个问题:如何在过滤器参数中编写 2 个条件?:page_path.eql => "/teams/1" or :page_path.eql => 'teams/2'
它适用于一种情况,但不适用于两种情况:(
output = Exits.results(profile, :filters => {:page_path.eql => "/teams/1"})
我有一个问题:如何在过滤器参数中编写 2 个条件?:page_path.eql => "/teams/1" or :page_path.eql => 'teams/2'
它适用于一种情况,但不适用于两种情况:(
output = Exits.results(profile, :filters => {:page_path.eql => "/teams/1"})
尝试这个
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
我认为它不理解正则表达式。