Sha256: 34be29b7cff296cb2efdc18c22a6774c37ce034ee37afc5a60709e0439f543b1

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

module Ems
  class Asset < ActiveRecord::Base

    attr_accessible :asset

    validates_attachment :asset, :presence => true,
      :content_type => { :content_type => ["image/jpg", "image/jpeg"] }

    belongs_to :assetable, :polymorphic => true
    # accepts_nested_attributes_for :assets

    has_attached_file :asset, :styles => {:original => "564x252>"}

    # 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

3 entries across 3 versions & 1 rubygems

Version Path
ems-0.1.10 app/models/ems/asset.rb
ems-0.1.9 app/models/ems/asset.rb
ems-0.1.8 app/models/ems/asset.rb