Don’t simply test for the presence of the magic Paperclip attribute, it will return a paperclip Attachment object and thus always be true:
- if user.photo.present? # always true
= image_tag(user.photo.url)
Use #photo? instead:
- if user.photo?
= image_tag(user.photo.url)
That's not true! #present? checks if attachment was assigned and #exists? checks if file is on storage(S3 or whatever). Here is attachment code from paperclip:
That means #present? is much faster that #exists? and you rarely need second unless you have problems with your storage.