Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From the <a href="https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/attachment.rb" rel="nofollow">paperclip github project</a>:</p> <p><a href="https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/attachment.rb" rel="nofollow">https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/attachment.rb</a></p> <pre><code># Returns the public URL of the attachment with a given style. This does # not necessarily need to point to a file that your Web server can access # and can instead point to an action in your app, for example for fine grained # security; this has a serious performance tradeoff. # # Options: # # +timestamp+ - Add a timestamp to the end of the URL. Default: true. # +escape+ - Perform URI escaping to the URL. Default: true. # # Global controls (set on has_attached_file): # # +interpolator+ - The object that fills in a URL pattern's variables. # +default_url+ - The image to show when the attachment has no image. # +url+ - The URL for a saved image. # +url_generator+ - The object that generates a URL. Default: Paperclip::UrlGenerator. # # As mentioned just above, the object that generates this URL can be passed # in, for finer control. This object must respond to two methods: # # +#new(Paperclip::Attachment, Paperclip::Options)+ # +#for(style_name, options_hash)+ def url(style_name = default_style, options = {}) default_options = {:timestamp =&gt; @options.use_timestamp, :escape =&gt; true} if options == true || options == false # Backwards compatibility. @url_generator.for(style_name, default_options.merge(:timestamp =&gt; options)) else @url_generator.for(style_name, default_options.merge(options)) end end </code></pre> <p>By default paperclip appends a timestamp parameter, pass <code>:timestamp =&gt; false</code> to the <code>url</code> method of your attachment: </p> <pre><code>image = Magick::ImageList.new('public' + @picture.photo.url(:original, :timestamp =&gt; false)) # =&gt; "public/system/photos/115/original/Kitchener-2011103100531.jpg" </code></pre> <p><strong>Edit:</strong> Actually, looks like they changed the option name since this didn't work for me with Paperclip 2.4.0. After inspecting my own source, the option is <code>:use_timestamp</code> but on github it's <code>:timestamp</code> - choose which one depending on the version of Paperclip you're using.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload