It looks like Paperclip doesn't honor the ActiveRecord dirty model. How do I detect the change in after_save
callback.
class User
has_attachment :avatar
after_save :do_something
def do_something
if name_changed?
#
end
# How to determine avatar was changed?
#if avatar_changed?
# #
#end
end
end
Note
I know I can detect the change in before_save
callback using avatar.dirty?
call, but the dirty
flag is set to false after save.
I can add a processor, but I need to perform my actions after the model data is saved.
You could try accessing the _changed?
method for one of the attributes:
if avatar_updated_at_changed?
# do something
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With