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)
user.photo?
will tell you if thephoto_file_name
attribute is set in the database.user.photo.exists?
will check that the file actually exists on the filesystem or S3, but is much slower.