Module Paperclip::Interpolations
In: lib/paperclip/interpolations.rb

This module contains all the methods that are available for interpolation in paths and urls. To add your own (or override an existing one), you can either open this module and define it, or call the Paperclip.interpolates method.

Methods

Constants

RIGHT_HERE = "#{__FILE__.gsub(%r{^\./}, "")}:#{__LINE__ + 3}"   Returns the interpolated URL. Will raise an error if the url itself contains ":url" to prevent infinite recursion. This interpolation is used in the default :path to ease default specifications.

Public Class methods

Hash access of interpolations. Included only for compatibility, and is not intended for normal use.

Hash assignment of interpolations. Included only for compatibility, and is not intended for normal use.

Returns a sorted list of all interpolations.

Perform the actual interpolation. Takes the pattern to interpolate and the arguments to pass, which are the attachment and style name. You can pass a method name on your record as a symbol, which should turn an interpolation pattern for Paperclip to use.

Public Instance methods

Returns the pluralized form of the attachment name. e.g. "avatars" for an attachment of :avatar

Returns the basename of the file. e.g. "file" for "file.jpg"

Returns the underscored, pluralized version of the class name. e.g. "users" for the User class. NOTE: The arguments need to be optional, because some tools fetch all class names. Calling class will return the expected class.

Returns an extension based on the content type. e.g. "jpeg" for "image/jpeg". Each mime type generally has multiple extensions associated with it, so if the extension from teh original filename is one of these extensions, that extension is used, otherwise, the first in the list is used.

Returns the extension of the file. e.g. "jpg" for "file.jpg" If the style has a format defined, it will return the format instead of the actual extension.

Returns the filename, the same way as ":basename.:extension" would.

Returns the id of the instance.

Returns the id of the instance in a split path form. e.g. returns 000/001/234 for an id of 1234.

Returns the to_param of the instance.

Returns the Rails.env constant.

Returns the Rails.root constant.

Returns the style, or the default style if nil is supplied.

Returns the timestamp as defined by the <attachment>_updated_at field in the server default time zone unless :use_global_time_zone is set to false. Note that a Rails.config.time_zone change will still invalidate any path or URL that uses :timestamp. For a time_zone-agnostic timestamp, use updated_at.

Returns an integer timestamp that is time zone-neutral, so that paths remain valid even if a server‘s time zone changes.

[Validate]