Check whether paperclip attachment is exists in callback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In our app, we need to work out user profile completeness when a profile is saved. This is done via a callback. In this callback, we also check for the existance of Paperclip attachments. | |
This should supposedly be done with the following: | |
`@user.document.exists?` | |
That, however, returns false in the callback while a file is being uploaded. It looks like it's stuck in limbo between deleting the old file and saving the new one. A solution to this is to simply use the following: | |
`@user.document?` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment