I would suggest it is a gotcha with regard to operator precedence and
the ability to not parenthesise arguments in ruby. Basically, the
first case has executed like this:
if project.data.has_attribute?( "cover_image_name" && !
project.data.cover_image_name.blank? )
Without including the brackets to delimit the argument list for
has_attribute?, the "cover_image_name" has been applied as the left
argument to &&.
Put the brackets in and it should be fine:
if project.data.has_attribute?("cover_image_name") && !
project.data.cover_image_name.blank?
end
Cheers,
Kim