mongoid predications updated
This commit is contained in:
parent
b6574263f6
commit
9facab1bc2
|
@ -3,37 +3,76 @@ module Ransack
|
||||||
module Mongoid
|
module Mongoid
|
||||||
module Attributes
|
module Attributes
|
||||||
module Predications
|
module Predications
|
||||||
|
def not_eq other
|
||||||
def eq(other)
|
|
||||||
{ name => other }.to_inquiry
|
|
||||||
end
|
|
||||||
|
|
||||||
def not_eq(other)
|
|
||||||
{ name => { '$ne' => other } }.to_inquiry
|
{ name => { '$ne' => other } }.to_inquiry
|
||||||
end
|
end
|
||||||
|
|
||||||
def matches(other)
|
def not_eq_any others
|
||||||
{ name => /#{Regexp.escape(other)}/i }.to_inquiry
|
grouping_any :not_eq, others
|
||||||
end
|
end
|
||||||
|
|
||||||
def does_not_match(other)
|
def not_eq_all others
|
||||||
{ "$not" => { name => /#{Regexp.escape(other)}/i } }.to_inquiry
|
|
||||||
end
|
|
||||||
|
|
||||||
def eq_all(others)
|
|
||||||
grouping_all :eq, others
|
|
||||||
end
|
|
||||||
|
|
||||||
def not_eq_all(others)
|
|
||||||
grouping_all :not_eq, others
|
grouping_all :not_eq, others
|
||||||
end
|
end
|
||||||
|
|
||||||
def eq_any(others)
|
def eq other
|
||||||
|
{ name => other }.to_inquiry
|
||||||
|
end
|
||||||
|
|
||||||
|
def eq_any others
|
||||||
grouping_any :eq, others
|
grouping_any :eq, others
|
||||||
end
|
end
|
||||||
|
|
||||||
def not_eq_any(others)
|
def eq_all others
|
||||||
grouping_any :not_eq, others
|
grouping_all :eq, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def in other
|
||||||
|
raise "not implemented"
|
||||||
|
end
|
||||||
|
|
||||||
|
def in_any others
|
||||||
|
grouping_any :in, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def in_all others
|
||||||
|
grouping_all :in, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def not_in other
|
||||||
|
raise "not implemented"
|
||||||
|
end
|
||||||
|
|
||||||
|
def not_in_any others
|
||||||
|
grouping_any :not_in, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def not_in_all others
|
||||||
|
grouping_all :not_in, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def matches other
|
||||||
|
{ name => /#{Regexp.escape(other)}/i }.to_inquiry
|
||||||
|
end
|
||||||
|
|
||||||
|
def matches_any others
|
||||||
|
grouping_any :matches, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def matches_all others
|
||||||
|
grouping_all :matches, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def does_not_match other
|
||||||
|
{ "$not" => { name => /#{Regexp.escape(other)}/i } }.to_inquiry
|
||||||
|
end
|
||||||
|
|
||||||
|
def does_not_match_any others
|
||||||
|
grouping_any :does_not_match, others
|
||||||
|
end
|
||||||
|
|
||||||
|
def does_not_match_all others
|
||||||
|
grouping_all :does_not_match, others
|
||||||
end
|
end
|
||||||
|
|
||||||
def gteq right
|
def gteq right
|
||||||
|
|
Loading…
Reference in New Issue