diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-13 19:55:26 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-13 19:55:26 -0200 |
commit | e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32 (patch) | |
tree | d22a091b3c9c87e990508fee482617535c660948 /activerecord/lib/active_record/relation/finder_methods.rb | |
parent | aac032073de638d3fcad5d878ae7d42354c9cee8 (diff) | |
parent | b56376b4509073a0ef7fc0a44e51619f1bf11d8e (diff) | |
download | rails-e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32.tar.gz rails-e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32.tar.bz2 rails-e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32.zip |
Merge pull request #8204 from nikitug/fix_dynamic_finder_result_check
Use nil? instead of blank? to check dynamic finder result
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib/active_record/relation/finder_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index abc67d9c15..44aeb309d6 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -263,7 +263,7 @@ module ActiveRecord conditions = Hash[attributes.map {|a| [a, args[attributes.index(a)]]}] result = where(conditions).send(match.finder) - if match.bang? && result.blank? + if match.bang? && result.nil? raise RecordNotFound, "Couldn't find #{@klass.name} with #{conditions.to_a.collect {|p| p.join(' = ')}.join(', ')}" else yield(result) if block_given? |