Paperclip: numbers strings after filename


I’m trying to instantiate the file from the saved file via paperclip.
The codes to open the file is:

barcodeFile = open(scan.barcode.url,“r”)

…but getting error of file not found as the “url” is extended as


with the number strings. I was searching 1) what the numbers strings
are, and 2) how I can get URL without the strings so that I will not
encounter file not found exception when I’m trying to instantiate the



I’ve resolved this issue. I found it on the source code of the library
as below.

# Returns the public URL of the attachment, with a given style.

Note that
# this does not necessarily need to point to a file that your web
# can access and can point to an action in your app, if you need
# grained security. This is not recommended if you don’t need the
# security, however, for performance reasons. Set use_timestamp to
# if you want to stop the attachment update time appended to the
def url(style_name = default_style, use_timestamp =
url = original_filename.nil? ? interpolate(@default_url,
style_name) : interpolate(@url, style_name)
use_timestamp && updated_at ? [url, updated_at].compact.join(url.include?("?") ? “&” : “?”) : url

so if you set false, it will turn off adding timestamp at the end.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs