remove_avatar! leaves remove_avatar == true even after persisting the removal #1318

jtomaszewski opened this Issue Feb 11, 2014 · 2 comments


None yet
2 participants

Although the docs seem more clear now (#1230), there's one bug in the implementation:

object.update(avatar: some_file)
object.avatar.present? # => true

object.remove_avatar # => true!
object.avatar.present? # => false
object.remove_avatar # => still true. Why? Avatar has been already removed, #remove_avatar should be back to nil now.

object.update(avatar: some_file)
object.avatar.present? # => false :O propably because of the #remove_avatar == true

Thus, to update the file after removing it, I had to explicitly do this:


user.remove_avatar = false # make sure #remove_avatar isn't true
user.update(avatar: new_file)

The problem is that I lost about ~1h on that - maybe we can fix it with something like after_save { remove_avatar = false } or should we note this on Wiki ?

@bensie bensie closed this in 88352b4 Feb 18, 2014

Thanks! 😄


bensie commented Feb 18, 2014

No problem, thanks for the detailed report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment