Class: Locomotive::ContentAsset
- Inherits:
-
Object
- Object
- Locomotive::ContentAsset
- Defined in:
- app/models/locomotive/content_asset.rb
Instance Method Summary collapse
-
#content_type ⇒ Object
fields ##.
- #extname ⇒ Object
-
#ordered ⇒ Object
scopes ##.
-
#site ⇒ Object
associations ##.
-
#source ⇒ Object
behaviours ##.
- #to_liquid ⇒ Object
Methods included from Extensions::Asset::Vignette
Instance Method Details
#content_type ⇒ Object
fields ##
11 |
# File 'app/models/locomotive/content_asset.rb', line 11 field :content_type, type: String |
#extname ⇒ Object
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 |
#ordered ⇒ Object
scopes ##
27 |
# File 'app/models/locomotive/content_asset.rb', line 27 scope :ordered, order_by(created_at: :desc) |
#site ⇒ Object
associations ##
18 |
# File 'app/models/locomotive/content_asset.rb', line 18 belongs_to :site, class_name: 'Locomotive::Site', validate: false, autosave: false |
#source ⇒ Object
behaviours ##
21 |
# File 'app/models/locomotive/content_asset.rb', line 21 validates_presence_of :source |
#to_liquid ⇒ Object
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 |