I’m trying to put a file link with a partial render, something like this:
#Main haml file
= render :partial => 'file_upload', :locals => {:f => f, :file_download => 'residence_cert'}
#Inside the partial
%a{:href => @postulant_info[file_download]}
But this is making a link just with the file name, not the full path to the file. Then realized that @postulant_info[file_download] is just giving me a String with the file name, not the carrierwave object
-logger.debug @postulant_info.residence_cert #this is returning my carrierwave object -> 'DocumentUploader'
-logger.debug @postulant_info['residence_cert'] #but this one is just returning a String, the DB record with the file name
One solution could be put the url in the render as a local like = render :partial => 'file_upload', :locals => {:f => f, :file_download => 'residence_cert', :url => @postulant_info.residence_cert.url} but I think “should” be unnecessary when you have the attribute name inside the partial template.
Any thought would be appreciated. Thanks in advance
At last I could achieve it with: