The format of the standard urls can be configured using
What parameters can go in the url format string?
:job is always present, and if not specified in the
url_format, is appended as a query parameter.
Parameters are taken from the Job object’s
url_attributes object (which is like an OpenStruct).
If the parameter is not present, the segment simply doesn’t appear (also the preceding delimiter character, e.g. “/”, “-“ or “.”, is removed)
Passing in attributes
url_attributes can be overridden by passing in attributes in the call to
How does this relate to models?
When using models you don’t deal with
url_attributes directly. Instead, this is populated from the model’s magic attributes (see Models for more details).
Let’s imagine we have a model
Then with only a
Parameters can be overridden in in the same way as before
This encodes all the information about the job and will always be present.
If not specified in the
url_format string it will be added as a query parameter.
:ext are taken from
:name, so you can split them in the url.
For example, with
Processors changing URL parameters
Processors can optionally update
url_attributes. For example, the imagemagick encode processor updates the file extension (if using
For example, with
url_format "/:name" and
Person model with columns
See Processors for more details.
By default all URLs are relative. You can set a host for the urls in configure
…or by passing as an argument…
"/media/:job" will generate URLs like
/media/W1s... and in turn match any incoming ones that look like
If, for whatever reason, you need the generated URLs to have a further prefix (such as when the app is mounted under a subdirectory), you can use
If the datastore supports it, you can get the URL for serving directly from the data store using
or from a model attachment
The File, S3 and Couch data stores support this, as well as any others that implement the correct interface as per the data stores doc.
Rails custom URLs
See Using with Rails