Commit 18ac3e1f by Tute Costa

Add note on file? vs exists? in the README

[fixes #1314]
[ci skip]
parent 30c37028
...@@ -260,6 +260,16 @@ end ...@@ -260,6 +260,16 @@ end
<%= image_tag @user.avatar.url(:thumb) %> <%= image_tag @user.avatar.url(:thumb) %>
``` ```
### Checking a file exists
There are two methods for checking if a file exists:
- `file?` and `present?` checks if the `_file_name` field is populated
- `exists?` checks if the file exists (will perform a TCP connection if stored in the cloud)
Keep this in mind if you are checking if files are present in a loop. The first
version is significantly more performant, but has different semantics.
### Deleting an Attachment ### Deleting an Attachment
Set the attribute to `nil` and save. Set the attribute to `nil` and save.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment