Paperclip - get image path without ActiveRecord model

In a specific view, I am presenting an array of POROs created from an SQL query (this is for performance reasons, since ActiveRecord models here will be a serious performance issue).

In this view, I need to display an image loaded using paperclip, but cannot find a way to force Paperclip to return the URL of the image without an ActiveRecord instance (attachment). I can get the image name from the database ("image.jpg") and the model name ("User").

I will need something like url ("image.jpg" ,: user ,: thumb).

I could hardcode the paths, but I would rather not do this, and let paperclip handle it.

Is it possible?

Thanks Ricardo

+4
source share
1 answer

I created an entity for here

Basically, your object should implement some ActiveModel modules for full folder requirements, because this library is closely related to ActiveRecord.

+1
source

Source: https://habr.com/ru/post/1438402/


All Articles