Sha256: 5bfdbf64a623514f3e1153fb70da588f929b3925994c54759c7f28ea97dc6bc8
Contents?: true
Size: 1022 Bytes
Versions: 1
Compression:
Stored size: 1022 Bytes
Contents
module AssetHostCore class Output < ActiveRecord::Base has_many :asset_outputs after_save :delete_asset_outputs, if: -> { self.size_changed? || self.extension_changed? } #---------- def self.paperclip_sizes @paperclip_sizes ||= begin sizes = {} Output.all.each do |output| sizes.merge! output.paperclip_options end sizes end end #---------- def code_sym self.code.to_sym end #---------- def paperclip_options { self.code.to_sym => { :geometry => '', :size => self.size, :format => self.extension.to_sym, :prerender => self.prerender, :output => self.id, :rich => self.is_rich } } end #---------- protected def delete_asset_outputs # destroy each AssetOutput, triggering file and cache deletion self.asset_outputs.each { |ao| ao.destroy } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asset_host_core-2.0.0.beta | app/models/asset_host_core/output.rb |