diff options
author | José Valim <jose.valim@gmail.com> | 2012-03-07 07:03:59 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-03-07 16:08:26 +0100 |
commit | 524e8a1a802d773f59cb6bb6466c8f6486084340 (patch) | |
tree | 6c48d5395cf0446eb1a379a0fda602752c559328 /activerecord/lib/active_record/attribute_methods.rb | |
parent | 3775058f1fde8dfb476fe7304fd9cfe7b45e8d8a (diff) | |
download | rails-524e8a1a802d773f59cb6bb6466c8f6486084340.tar.gz rails-524e8a1a802d773f59cb6bb6466c8f6486084340.tar.bz2 rails-524e8a1a802d773f59cb6bb6466c8f6486084340.zip |
Merge pull request #5316 from Jacobkg/master
Update ActiveRecord::AttributeMethods#attribute_present? to return false for empty strings
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 0dbc737de0..2a7a77777d 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -212,7 +212,7 @@ module ActiveRecord # nil nor empty? (the latter only applies to objects that respond to empty?, most notably Strings). def attribute_present?(attribute) value = read_attribute(attribute) - !value.nil? || (value.respond_to?(:empty?) && !value.empty?) + !value.nil? && !(value.respond_to?(:empty?) && value.empty?) end # Returns the column object for the named attribute. |