Sha256: 559706f69fddc694e5173ffa7407817d3fe8e5427c407004971e58cf705a1946

Contents?: true

Size: 505 Bytes

Versions: 52

Compression:

Stored size: 505 Bytes

Contents

class Kuhsaft::Asset < ActiveRecord::Base
  scope :by_date, order('updated_at DESC')
  mount_uploader :file, Kuhsaft::AssetUploader
  
  def file_type
    if file.path.present? && ext = File.extname(file.path).split('.').last
      ext.to_sym unless ext.blank?
    end
  end
  
  def name
    File.basename(file.path) if file.present? && file.path.present?
  end
  
  def path
    file.url
  end
  
  def path=val
    # do nothing
  end
  
  def filename
    try(:file).try(:file).try(:filename)
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
kuhsaft-1.2.14 app/models/kuhsaft/asset.rb
kuhsaft-1.2.13 app/models/kuhsaft/asset.rb
kuhsaft-1.2.12 app/models/kuhsaft/asset.rb
kuhsaft-1.2.11 app/models/kuhsaft/asset.rb
kuhsaft-1.2.10 app/models/kuhsaft/asset.rb
kuhsaft-1.2.9 app/models/kuhsaft/asset.rb
kuhsaft-1.2.8 app/models/kuhsaft/asset.rb
kuhsaft-1.2.7 app/models/kuhsaft/asset.rb
kuhsaft-1.2.6 app/models/kuhsaft/asset.rb
kuhsaft-1.2.5 app/models/kuhsaft/asset.rb
kuhsaft-1.2.4 app/models/kuhsaft/asset.rb
kuhsaft-1.2.3 app/models/kuhsaft/asset.rb
kuhsaft-1.2.2 app/models/kuhsaft/asset.rb
kuhsaft-1.2.1 app/models/kuhsaft/asset.rb
kuhsaft-1.2.0 app/models/kuhsaft/asset.rb
kuhsaft-1.1.1 app/models/kuhsaft/asset.rb
kuhsaft-1.1.0 app/models/kuhsaft/asset.rb
kuhsaft-1.0.3 app/models/kuhsaft/asset.rb
kuhsaft-1.0.2 app/models/kuhsaft/asset.rb
kuhsaft-1.0.1 app/models/kuhsaft/asset.rb