Class: Downloadable

Inherits:
ProductDownload show all
Defined in:
app/models/downloadable.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) filename



11
12
13
# File 'app/models/downloadable.rb', line 11

def filename
   return attachment_file_name
end

- (Object) validate

if there are errors from the plugin, then add a more meaningful message



20
21
22
23
24
25
26
27
# File 'app/models/downloadable.rb', line 20

def validate
  unless attachment.errors.empty?
    # uncomment this to get rid of the less-than-useful interrim messages
    # errors.clear 
    errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file."
    false
  end
end

- (Boolean) zipfile?

Returns:

  • (Boolean)


15
16
17
# File 'app/models/downloadable.rb', line 15

def zipfile?
  attachment_content_type == 'application/zip'
end