paperclip

https://github.com/thoughtbot/paperclip

Ruby

Easy file attachment management for ActiveRecord

Paperclip::Attachment#url

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, options_hash)+
+#for(style_name, options_hash)+

Source | Google | Stack overflow

Edit

git clone [email protected]:thoughtbot/paperclip.git

cd paperclip

open lib/paperclip/attachment.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Paperclip--Attachment-url-for-pr


# Commit to git

git add lib/paperclip/attachment.rbgit commit -m "better docs for Paperclip::Attachment#url"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Paperclip--Attachment-url-for-pr

hub pull-request


# Celebrate!