I've found this solution that uses a checkbox as a flag to delete the image. However, I want to use a link_to
. Basically, next to the image attachment, I want to have a "Delete Avatar" link. If possible, I want the link to only delete the image, and not update the other attributes.
User class
class User < ActiveRecord::Base
has_attached_file :avatar
attr_accessible :avatar
In the form
link_to "Delete Avatar", {:action => :update}, :method => :put
Obviously this doesn't actually delete the image just yet. What would be the best way to do this? Have the link set a hidden flag and then update? Or is this just a bad idea (if so why)?