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



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

def attachment
  processed_attachment.present? ? processed_attachment : unprocessed_attachment
end

#attachment=(value) ⇒ Object



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

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

#thumbnail_url(*args) ⇒ Object



33
34
35
# File 'app/models/pageflow/image_file.rb', line 33

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

#urlObject



37
38
39
40
41
# File 'app/models/pageflow/image_file.rb', line 37

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