我正在使用Paperclip在我的Rails应用程序中保存图片:
用户模型:
class User < ActiveRecord::Base
has_one :profile
end
个人资料模型:
class Profile < ActiveRecord::Base
has_attached_file :avatar, :styles => {:medium => "300x300>", :thumb => "100x100>"}
belongs_to :user
end
我尝试通过以下方式删除头像:
current_user.profile.avatar = nil
current_user.profile.save
但它不能工作。这可能吗?