내 carrierwave 모델 객체에 Accesing 뭔가 :, 내가 렌더링 부분이있는 파일 링크를 넣어려고 속성 이름
#Main haml file
= render :partial => 'file_upload', :locals => {:f => f, :file_download => 'residence_cert'}
#Inside the partial
%a{:href => @postulant_info[file_download]}
그러나 이것은 단지 파일 이름과 링크를하고있다, 파일의 전체 경로가 아닙니다. 그런 다음 @postulant_info[file_download]
그냥 같은 지역으로 = render :partial => 'file_upload', :locals => {:f => f, :file_download => 'residence_cert', :url => @postulant_info.residence_cert.url}
을 렌더링에 URL을 넣을 수 있습니다하지 carrierwave 객체를 파일 이름으로 나에게
-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
하나 개의 솔루션을 문자열을주고있다하지만 난 때 불필요한 "해야"생각 실현 부분 템플릿 안에 속성 이름이 있습니다.
어떤 생각이라도 좋을 것입니다. 사전
하지만 내 문제는 난 템플릿 거 residence_cert' '이외의 다른 속성을 사용한다는 것입니다. 나는 그것을 할 수있는 일반적인 방법이 필요하다. –