Method: Refile.upload_url

Defined in:
lib/refile.rb

.upload_url(backend, host: nil, prefix: nil) ⇒ String

Receives a Refile backend and returns a URL to the Refile application where files can be uploaded.

Examples:

Refile.upload_url(Refile.store)

Parameters:

  • backend (Refile::Backend)

    The backend to generate a URL for

  • host (String, nil) (defaults to: nil)

    Override the host

  • prefix (String, nil) (defaults to: nil)

    Adds a prefix to the URL if the application is not mounted at root

Returns:

  • (String)

    The generated URL



333
334
335
336
337
# File 'lib/refile.rb', line 333

def upload_url(backend, host: nil, prefix: nil)
  backend_name = Refile.backends.key(backend)

  ::File.join(app_url(host: host, prefix: prefix), backend_name)
end