如何跳过基于虚拟属性的后期处理?
在 before_asset_post_process 回调中,我的虚拟属性始终为零
创造
attachment = Attachment.create(asset: File.open(file.png), :skip_thumb => 1)
可连接模型
class Attachment < AR::Base
attr_accessor :skip_thumb
has_attached_file :asset, :styles => lambda { |attachment| { :thumb => ["100>", 'jpg'] ,
:thumb_big => ["200>", 'jpg']
}
before_asset_post_process :proceed_or_cancel
def proceed_or_cancel
#self.skip_thumb is always nil
if (self.skip_thumb.present?)
return false
end
end
end