lib/parse/query.rb in parse-ruby-client-0.1.10 vs lib/parse/query.rb in parse-ruby-client-0.1.11

- old
+ new

@@ -84,10 +84,15 @@ def value_not_in(field, values) add_constraint field, { "$nin" => values } self end + def related_to(field,value) + h = {"object" => value, "key" => field} + add_constraint("$relatedTo", h ) + end + def exists(field, value = true) add_constraint field, { "$exists" => value } self end @@ -129,13 +134,13 @@ order_string = @order_by order_string = "-#{order_string}" if @order == :descending query.merge!(:order => order_string) end - def merge_attribute(attribute, query) + def merge_attribute(attribute, query, query_field = nil) value = self.instance_variable_get("@#{attribute.to_s}") return if value.nil? - query.merge!(attribute => value) + query.merge!((query_field || attribute) => value) end end -end \ No newline at end of file +end