You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The specification for attribute_present? says that it should return false if the attribute is nil or empty:
"Returns true if the specified attribute has been set by the user or by a database load and is neither nil nor empty? (the latter only applies to objects that respond to empty?, most notably Strings)."
However, the code is here:
def attribute_present?(attribute)
value = read_attribute(attribute)
!value.nil? || (value.respond_to?(:empty?) && !value.empty?)
end
The part that reads !value.nil? will return true for empty strings, and since it is an OR, will ignore the second part.
The text was updated successfully, but these errors were encountered:
The specification for attribute_present? says that it should return false if the attribute is nil or empty:
"Returns true if the specified attribute has been set by the user or by a database load and is neither nil nor empty? (the latter only applies to objects that respond to empty?, most notably Strings)."
However, the code is here:
def attribute_present?(attribute)
value = read_attribute(attribute)
!value.nil? || (value.respond_to?(:empty?) && !value.empty?)
end
The part that reads !value.nil? will return true for empty strings, and since it is an OR, will ignore the second part.
The text was updated successfully, but these errors were encountered: