Class: Pageflow::ImageFile

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ImageFileStateMachine, UploadedFile
Defined in:
app/models/pageflow/image_file.rb

Instance Method Summary collapse

Methods included from UploadedFile

#usage_id

Methods included from ImageFileStateMachine

#publish!, #retry!, #retryable?

Instance Method Details

#attachmentObject


22
23
24
# File 'app/models/pageflow/image_file.rb', line 22

def attachment
  processed_attachment.present? ? processed_attachment : unprocessed_attachment
end

#attachment=(value) ⇒ Object


26
27
28
# File 'app/models/pageflow/image_file.rb', line 26

def attachment=(value)
  self.unprocessed_attachment = value
end

#thumbnail_url(*args) ⇒ Object


30
31
32
# File 'app/models/pageflow/image_file.rb', line 30

def thumbnail_url(*args)
  processed_attachment.url(*args)
end

#urlObject


34
35
36
37
38
# File 'app/models/pageflow/image_file.rb', line 34

def url
  if processed_attachment.present?
    attachment.url(:large)
  end
end