diff options
author | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2013-12-30 01:53:02 +0530 |
---|---|---|
committer | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2013-12-30 01:53:02 +0530 |
commit | a2985e206709f7947ef427a527d72ff89824931a (patch) | |
tree | 9c42b2f69bb69ed07820f7bb9d9a0eb98acd19c6 /activerecord/lib | |
parent | 15e2eb42a7b1c251defd088ac65a89f152a307f6 (diff) | |
download | rails-a2985e206709f7947ef427a527d72ff89824931a.tar.gz rails-a2985e206709f7947ef427a527d72ff89824931a.tar.bz2 rails-a2985e206709f7947ef427a527d72ff89824931a.zip |
raise `ArgumentError` exception if `Model.where.not` is called with `nil` argument
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 3d0709266a..78da6a83ec 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -37,6 +37,8 @@ module ActiveRecord def not(opts, *rest) where_value = @scope.send(:build_where, opts, rest).map do |rel| case rel + when NilClass + raise ArgumentError, 'Invalid argument for .where.not(), got nil.' when Arel::Nodes::In Arel::Nodes::NotIn.new(rel.left, rel.right) when Arel::Nodes::Equality |