lib/mongomodel/support/scope/query_methods.rb in mongomodel-0.2.6 vs lib/mongomodel/support/scope/query_methods.rb in mongomodel-0.2.7
- old
+ new
@@ -29,9 +29,15 @@
new_scope
end
CEVAL
end
+ def from(value, &block)
+ new_scope = clone
+ new_scope.from_value = value.is_a?(String) ? klass.database.collection(value) : value
+ new_scope
+ end
+
def reverse_order
if order_values.empty?
order(:id.desc)
else
except(:order).order(MongoOrder.parse(order_values).reverse.to_a)