Module: GeoConcerns::DownloadBehavior

Extended by:
ActiveSupport::Concern
Includes:
CurationConcerns::DownloadBehavior
Included in:
DownloadsController
Defined in:
app/controllers/concerns/geo_concerns/download_behavior.rb

Instance Method Summary collapse

Instance Method Details

#load_fileActiveFedora::File, ...

Overrides CurationConcerns::DownloadBehavior#load_file. Uses GeoConcerns::DerivativePath instead of CurationConcerns::DerivativePath. Loads the file specified by the HTTP parameter ‘:file`. If this object does not have a file by that name, return the default file as returned by #default_file

Returns:

  • (ActiveFedora::File, String, NilClass)

    returns the file or the path to a file



12
13
14
15
16
17
18
# File 'app/controllers/concerns/geo_concerns/download_behavior.rb', line 12

def load_file
  file_reference = params[:file]
  return default_file unless file_reference
  file_path = GeoConcerns::DerivativePath.derivative_path_for_reference(params[asset_param_key],
                                                                        file_reference)
  File.exist?(file_path) ? file_path : nil
end