Going back to accessing user attributes (name, e-mail, avatar, etc) for the comments section ("identify user as commenter"), why does it let me print out some values but not use them in conditionals?
Why can I do this? (Prints the avatar next to the comment as it should)
<%= image_tag comment.user.avatar.url, size: "64" %>
But not this? (Won't let me check if there's an avatar or not first)
<% if comment.user.avatar.url.empty/blank/nil/present? %>
So if a commenter hasn't uploaded an avatar yet, it returns:
undefined method \'avatar\' for nil:NilClass
Is there a method I need to define in a controller, or a scope in a model, or is there another way of checking in this situation?