aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods.rb
diff options
context:
space:
mode:
authorJacob Green <jacob@nationbuilder.com>2012-03-06 22:32:29 -0800
committerJacob Green <jacob@nationbuilder.com>2012-03-06 22:32:29 -0800
commit04aca254cc927663c9f53560bbe0d0b680194c5e (patch)
tree582f2550abdd63fbdab4b3e5ab4dd5365fbc32fd /activerecord/lib/active_record/attribute_methods.rb
parentd87ec9d3108afda28a5744d0b7edd328c3c284d1 (diff)
downloadrails-04aca254cc927663c9f53560bbe0d0b680194c5e.tar.gz
rails-04aca254cc927663c9f53560bbe0d0b680194c5e.tar.bz2
rails-04aca254cc927663c9f53560bbe0d0b680194c5e.zip
attribute_present? should return false for empty strings
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb2
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 3e27e85f02..93c243e7b1 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -189,7 +189,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.