lib/active_house/whereable.rb in active_house-0.3.2 vs lib/active_house/whereable.rb in active_house-0.4.0
- old
+ new
@@ -44,7 +44,14 @@
def where(*conditions)
raise ArgumentError, 'wrong number of arguments' if conditions.empty?
formatted_conditions = Array.wrap(format_condition(*conditions))
chain_query conditions: (@conditions + formatted_conditions).uniq
end
+
+ def where_not(*conditions)
+ raise ArgumentError, 'wrong number of arguments' if conditions.empty?
+ formatted_conditions = Array.wrap(format_condition(*conditions))
+ negative_condition = "NOT (#{formatted_conditions.join(' AND ')})"
+ chain_query conditions: (@conditions + [negative_condition]).uniq
+ end
end
end