Sha256: 3bffc9fb7db499c78df08b361c14ee7e0bfcab582da631a9c244e0017ba765c2

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

module GeoConcerns
  module DownloadBehavior
    extend ActiveSupport::Concern
    include CurationConcerns::DownloadBehavior

    # 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}
    # @return [ActiveFedora::File, String, NilClass] returns the file or the path to a file
    def load_file
      file_reference = params[:file]
      return default_file unless file_reference
      file_path = GeoConcerns::DerivativePath.derivative_path_for_reference(asset, file_reference)
      File.exist?(file_path) ? file_path : nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geo_concerns-0.0.6 app/controllers/concerns/geo_concerns/download_behavior.rb