Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
attribute_present? incorrectly returns true for empty strings #5314
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:
The part that reads !value.nil? will return true for empty strings, and since it is an OR, will ignore the second part.