5
votes

I have a model called Tile, and it has attachment: has_attachment :image_attachment

I can use cl_image_tag @tile.image_attachment.path to display img tag but I want to get only full URL to embed is an background image in inline style, is there a way to get full URL?

``@tile.image_attachment.path returns v1458814322/bgo1zuv4kji17f58x5m5.jpg

2

2 Answers

6
votes

You just need to use cl_image_path(@tile.image_attachment)

3
votes

If you want to access the URL somewhere else than in a view file:

options = {width: 50, height: 50, crop: :fill}
Cloudinary::Utils.cloudinary_url(image_id, options)