I am having trouble retrieving the URL of images uploaded via Paperclip.
I set the URL using the following code in my model:
has_attached_file :banner,
:path => "/www/banners/:foo-:id.:extension",
:url => "http://example.com/:foo-:id.:extension"
In my views, I can retrieve the URL just fine by running @gallery.banner.url
The problem arises when I try to retrieve the same banner.url in a rake task. There is no column for url in the database table, so how does my controller and view know what it is?
My guess is this has something to do with the controller using Gallery.find to retrieve the object, whereas my rake task uses Gallery.where to find the objects.
I am using Rails 3 and loading the Rails environment in the rake task.