/Jonas
> --
> You received this message because you are subscribed to the Google Groups "carrierwave" group.
> To post to this group, send email to carri...@googlegroups.com.
> To unsubscribe from this group, send email to carrierwave...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/carrierwave?hl=en.
>
>
There are a lot of moving parts here and a lot of it depends on how
your storage solution works. Are you using the file store, or a
different store? This is how #url is implemented in CarrierWave:
def url
if file.respond_to?(:url) and not file.url.blank?
file.url
elsif current_path
File.expand_path(current_path).gsub(File.expand_path(root), '')
end
end
As you can see it uses current_path unless the file itself responds to
#url (which it should for all storage engines except for file
storage). This is for good reason: filename works pretty
unintuitively, it does not actually *return* the file's filename,
rather it's used to *construct* the filename of the newly uploaded
file. If you want the *actual* filename, I'd suggest doing something
like File.basename(current_path), this will be much more reliable, and
should also work with versions. Again, this only works with the file
store, if you use any other store, then you can't use current_path,
because it will most likely return nothing, or at least nothing
particularly useful.
/Jonas