1

我有一个问题:如何在过滤器参数中编写 2 个条件?:page_path.eql => "/teams/1" or :page_path.eql => 'teams/2'

它适用于一种情况,但不适用于两种情况:(

output = Exits.results(profile, :filters => {:page_path.eql => "/teams/1"})
4

1 回答 1

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我认为它不理解正则表达式。

于 2012-08-15T10:25:04.997 回答