Sha256: 4c3b1dae654222cd39f82e3bd93ccf69a4aaaf2271c7819eed9112996c522c3b

Contents?: true

Size: 513 Bytes

Versions: 14

Compression:

Stored size: 513 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

14 entries across 14 versions & 1 rubygems

Version Path
kuhsaft-2.2.6 app/models/kuhsaft/asset.rb
kuhsaft-2.2.5 app/models/kuhsaft/asset.rb
kuhsaft-2.2.4 app/models/kuhsaft/asset.rb
kuhsaft-2.2.3 app/models/kuhsaft/asset.rb
kuhsaft-2.2.2 app/models/kuhsaft/asset.rb
kuhsaft-2.2.1 app/models/kuhsaft/asset.rb
kuhsaft-2.2.0 app/models/kuhsaft/asset.rb
kuhsaft-2.1.2 app/models/kuhsaft/asset.rb
kuhsaft-2.1.1 app/models/kuhsaft/asset.rb
kuhsaft-2.1.0 app/models/kuhsaft/asset.rb
kuhsaft-2.0.3 app/models/kuhsaft/asset.rb
kuhsaft-2.0.2 app/models/kuhsaft/asset.rb
kuhsaft-2.0.1 app/models/kuhsaft/asset.rb
kuhsaft-2.0.0 app/models/kuhsaft/asset.rb