2015-01-07 2 views
0

내 클립 설정은 응용 프로그램 폴더의 외부 파일 :종이 클립 -

has_mongoid_attached_file :avatar, 
          :path => "/nas/avatars/:id/:style/:id.:extension", 
          :url => "/system/:id/:style/:id.:extension", 
          :styles => { :profile => "100x100", :thumb => "64x64" } 

내가하여 게재하도록 노력 :

image_tag @profile.avatar.url(:profile) 

그러나 반환/시스템/54995fec7061762375100000/프로필/54995fec7061762375100000. jpg 404 찾을 수 없음

응용 프로그램 폴더 (마운트 된 NAS) 외부에서 파일을 실제로 저장할 수 있습니까?

+0

확인하시기 바랍니다. http://stackoverflow.com/questions/23950986/rails-paperclip-is-there-any-option-to-save-the-uploaded-file-outside-of-the-p?answertab=votes # tab-top –

답변

1

public 디렉토리가 아니기 때문에이 파일을 어떻게 든 제공해야합니다. 한 가지 방법은 (내가 사용하는) 별도의 컨트롤러를 만드는 것입니다. 예 :

def show 
    send_file @profile.avatar.path(:profile), type: 'image/jpeg', disposition: 'inline' 
end 

symlink로 시도 할 수도 있지만 작동 방법을 모르겠습니다.