Sha256: f191313476cfb5f7db5e60965ea95828d5b8cde8cd7be3671645e10e11e399dc

Contents?: true

Size: 511 Bytes

Versions: 5

Compression:

Stored size: 511 Bytes

Contents

module Ems
  class Asset < ActiveRecord::Base
    
    validates_attachment :asset, :presence => true,
      :content_type => { :content_type => ["image/jpg", "image/jpeg"] }
          
    belongs_to :assetable, :polymorphic => true
    
    has_attached_file :asset, :styles => {:original => "564x252>"}.merge(PAPERCLIP_STORAGE_OPTIONS)
    
    # virtual alt text accessor - returns the title of the image otherwise the path
    def alt
      alt = self.title 
      alt ||= self.image.url
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ems-0.0.8 app/models/ems/asset.rb
ems-0.0.7 app/models/ems/asset.rb
ems-0.0.6 app/models/ems/asset.rb
ems-0.0.5 app/models/ems/asset.rb
ems-0.0.4 app/models/ems/asset.rb