aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/query_attribute.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/relation/query_attribute.rb')
-rw-r--r--activerecord/lib/active_record/relation/query_attribute.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_attribute.rb b/activerecord/lib/active_record/relation/query_attribute.rb
index 0e1f64775d..5a9a7fd432 100644
--- a/activerecord/lib/active_record/relation/query_attribute.rb
+++ b/activerecord/lib/active_record/relation/query_attribute.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../attribute"
module ActiveRecord
@@ -14,6 +16,11 @@ module ActiveRecord
def with_cast_value(value)
QueryAttribute.new(name, value, type)
end
+
+ def nil?
+ !value_before_type_cast.is_a?(StatementCache::Substitute) &&
+ (value_before_type_cast.nil? || value_for_database.nil?)
+ end
end
end
end