Class: Asset

Inherits:
ApplicationRecord show all
Includes:
Concerns::Taggable
Defined in:
app/models/asset.rb

Instance Method Summary collapse

Methods included from Concerns::Taggable

#related, #taggable?, #tags, #tags_string

Instance Method Details

#actual_filenameObject



24
25
26
# File 'app/models/asset.rb', line 24

def actual_filename
  read_attribute(:filename)
end

#deletable?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/asset.rb', line 32

def deletable?
  images.empty? && content_pictures.empty? && attachments.empty?
end

#extensionObject



28
29
30
# File 'app/models/asset.rb', line 28

def extension
  actual_filename.to_s.split('.').last.downcase
end

#imageObject



20
21
22
# File 'app/models/asset.rb', line 20

def image
  Udongo::Assets::Resizer.new(self) if image?
end

#image?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/models/asset.rb', line 16

def image?
  content_type.to_s.include?('image')
end