This doesn't work:
这不起作用:
filter :name, :as => :string
Because mongoid ids are not strings, you can't filter on the ids as a string. Is there a nice way to filter on the ids by creating a custom filter type?
因为mongoid id不是字符串,所以不能将id作为字符串过滤。有没有一种很好的方法可以通过创建自定义过滤器类型来过滤ID?
1 个解决方案
#1
3
Found a way - I'm not sure exactly why it works yet, but:
找到了一种方法 - 我不确定它为什么会起作用,但是:
filter :device_id, :as => :numeric
does the trick.
诀窍。
#1
3
Found a way - I'm not sure exactly why it works yet, but:
找到了一种方法 - 我不确定它为什么会起作用,但是:
filter :device_id, :as => :numeric
does the trick.
诀窍。