I have a model that has paperclip attachments.
The model might be used in multiple rails apps
I need to return a full (non-relative) url to the attachment as part of a JSON API being consumed elsewhere.
I'd like to abstract the paperclip aspect and have a simple virtual attribute like this:
def thumbnail_url
self.photo.url(:thumb)
end
This however only gives me the relative path. Since it's in the model I can't use the URL helper methods, right?
What would be a good approach to prepending the application root url since I don't have helper support? I would like to avoid hardcoding something or adding code to the controller method that assembles my JSON.
Thank you