method

generate_url

Importance_0
v7.1.3.4 - Show latest stable - 0 notes - Class: DiskService
generate_url(key, expires_in:, filename:, content_type:, disposition:) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activestorage/lib/active_storage/service/disk_service.rb, line 124
      def generate_url(key, expires_in,, filename,, content_type,, disposition))
        content_disposition = content_disposition_with(type: disposition, filename: filename)
        verified_key_with_expiration = ActiveStorage.verifier.generate(
          {
            key: key,
            disposition: content_disposition,
            content_type: content_type,
            service_name: name
          },
          expires_in: expires_in,
          purpose: :blob_key
        )

        if url_options.blank?
          raise ArgumentError, "Cannot generate URL for #{filename} using Disk service, please set ActiveStorage::Current.url_options."
        end

        url_helpers.rails_disk_service_url(verified_key_with_expiration, filename: filename, **url_options)
      end
Register or log in to add new notes.