Sha256: b761ecfdb03db8e05bffa467d41b3acebe52446489cd9ac1fce39094b7e83950
Contents?: true
Size: 1015 Bytes
Versions: 14
Compression:
Stored size: 1015 Bytes
Contents
module Uploader module Asset # Save asset # Usage: # # class Asset < ActiveRecord::Base # include Uploader::Asset # # def uploader_create(params, request = nil) # self.user = request.env['warden'].user # super # end # end # def uploader_create(params, request = nil) self.guid = params[:guid] self.assetable_type = params[:assetable_type] self.assetable_id = params[:assetable_id] save end # Destroy asset # Usage (cancan example): # # class Asset < ActiveRecord::Base # include Uploader::Asset # # def uploader_destroy(params, request = nil) # ability = Ability.new(request.env['warden'].user) # if ability.can? :delete, self # super # else # errors.add(:id, :access_denied) # end # end # end # def uploader_destroy(params, request) destroy end end end
Version data entries
14 entries across 14 versions & 2 rubygems