diff options
Diffstat (limited to 'activerecord/lib/active_record/null_relation.rb')
-rw-r--r-- | activerecord/lib/active_record/null_relation.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/null_relation.rb b/activerecord/lib/active_record/null_relation.rb index 807c301596..fa6eaa7e64 100644 --- a/activerecord/lib/active_record/null_relation.rb +++ b/activerecord/lib/active_record/null_relation.rb @@ -30,10 +30,18 @@ module ActiveRecord true end + def none? + true + end + def any? false end + def one? + false + end + def many? false end @@ -62,9 +70,7 @@ module ActiveRecord calculate :maximum, nil end - def calculate(operation, _column_name, _options = {}) - # TODO: Remove _options argument as soon we remove support to - # activerecord-deprecated_finders. + def calculate(operation, _column_name) if [:count, :sum, :size].include? operation group_values.any? ? Hash.new : 0 elsif [:average, :minimum, :maximum].include?(operation) && group_values.any? @@ -77,5 +83,9 @@ module ActiveRecord def exists?(_id = false) false end + + def or(other) + other.spawn + end end end |