lib/rom/sql/relation.rb in rom-sql-0.4.0.beta1 vs lib/rom/sql/relation.rb in rom-sql-0.4.0.beta2
- old
+ new
@@ -123,18 +123,42 @@
# @api public
def select_append(*args, &block)
__new__(dataset.__send__(__method__, *args, &block))
end
+ # Returns a copy of the relation with a SQL DISTINCT clause.
+ #
+ # @example
+ # users.distinct(:country)
+ #
+ # @return [Relation]
+ #
+ # @api public
+ def distinct(*args, &block)
+ __new__(dataset.__send__(__method__, *args, &block))
+ end
+
# Restrict a relation to match criteria
#
# @example
# users.where(name: 'Jane')
#
# @return [Relation]
#
# @api public
def where(*args, &block)
+ __new__(dataset.__send__(__method__, *args, &block))
+ end
+
+ # Restrict a relation to not match criteria
+ #
+ # @example
+ # users.exclude(name: 'Jane')
+ #
+ # @return [Relation]
+ #
+ # @api public
+ def exclude(*args, &block)
__new__(dataset.__send__(__method__, *args, &block))
end
# Set order for the relation
#