I suspect your options are problematic, because if the photo is zero, both of your operators should return an Undefined method.
You do not even need to check ".nil?". Since you assumed that your check is in the view, and not in the controller, I suppose you check the @instance variable, which will always be zero if undefined. So simple:
if @someObject ... else ...
If you put the condition in your controller, then use the @instance variable again, and you will always have at least zero if undefined.
source share