Class: Locomotive::ContentAsset

Inherits:
Object
  • Object
show all
Includes:
Extensions::Asset::Types, Extensions::Asset::Vignette, Mongoid::Document
Defined in:
app/models/locomotive/content_asset.rb

Instance Method Summary collapse

Methods included from Extensions::Asset::Vignette

#vignette_url

Instance Method Details

#content_typeObject

fields ##



11
# File 'app/models/locomotive/content_asset.rb', line 11

field :content_type,  type: String

#extnameObject



34
35
36
37
# File 'app/models/locomotive/content_asset.rb', line 34

def extname
  return nil unless self.source?
  File.extname(self.source_filename).gsub(/^\./, '')
end

#orderedObject

scopes ##



27
# File 'app/models/locomotive/content_asset.rb', line 27

scope :ordered,     order_by(created_at: :desc)

#siteObject

associations ##



18
# File 'app/models/locomotive/content_asset.rb', line 18

belongs_to :site, class_name: 'Locomotive::Site', validate: false, autosave: false

#sourceObject

behaviours ##



21
# File 'app/models/locomotive/content_asset.rb', line 21

validates_presence_of :source

#to_liquidObject



39
40
41
# File 'app/models/locomotive/content_asset.rb', line 39

def to_liquid
  { url: self.source.url }.merge(self.attributes).stringify_keys
end