Class: Decidim::PrivateExport

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/private_export.rb

Instance Method Summary collapse

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/decidim/private_export.rb', line 19

def expired?
  expires_at < Time.zone.now
end

#private_download_authorized?(user, requested_attachment_name) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'app/models/decidim/private_export.rb', line 28

def private_download_authorized?(user, requested_attachment_name)
  return false unless requested_attachment_name.to_s == "file"

  attached_to == user
end

#set_content_type_and_sizeObject



23
24
25
26
# File 'app/models/decidim/private_export.rb', line 23

def set_content_type_and_size
  self.content_type = file.content_type
  self.file_size = file.byte_size
end