Created
November 24, 2012 14:33
-
-
Save moonglum/4139906 to your computer and use it in GitHub Desktop.
I don't really understand this behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
relation = base_relation.restrict do |r| | |
r.name.eq "Cologne" | |
end.sort_by do |r| | |
[ r.name, r.country ] | |
end | |
mongo_visitor = Veritas::Adapter::Mongo::Visitor.new relation | |
p mongo_visitor.query | |
#=> {:name=>"Cologne"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@moonglum btw, you can also write the restrict part like
base_relation.restrict(:name => 'Cologne')
, this is a short cut for the common case where you just want to do an equality match of one or more attributes.