2017-01-19 1 views
0

paperclip_processors 디렉토리를 포함해야했습니다. 크롭 프로세서를 찾을 수 없음 오류가 발생합니다. 나는 railscast 그 applicatio.rb다음 경로 중 하나에서 'Cropper'프로세서를 찾을 수 없습니다. lib/paperclip, lib/paperclip_processors

config.autoload_paths += %W(#{Rails.root}/lib) 
config.autoload_paths += %W(#{Rails.root}/lib/paperclip_processors) 

에서

module Paperclip 
class Cropper < Thumbnail 
def transformation_command 
    if crop_command 
    crop_command + super.sub(/ -crop \S+/, '') 
    else 
    super 
    end 
end 

def crop_command 
    target = @attachment.instance 
    if target.cropping? 
    " -crop '#{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}'" 
    end 
end 
end 
end 

및 user.rb

has_attached_file :profile_picture, { 
styles: { 
    original: "1400>", 
    medium: "400>", 
    thumb: "150>" 
}, 
:processors => [:cropper], 
storage: :s3, 
s3_credentials: S3_CREDENTIALS, 

}

답변

0

내 맥 I에서 개발되었다 똑같이 일을 수행 이 문제에 직면하지 않았지만 EC2 우분투 인스턴스에 배포 할 때이 오류가 발생했습니다.

프로세서의 파일 이름에 대문자를 변경했을 때 효과가있었습니다. 예를 들어 파일 이름이 "Cropper.rb"인 경우 "cropper.rb"로 이름을 변경하고 시도하십시오.

내 환경은 다음과 같습니다 루비 2.3.1 레일 4.2.4 종이 클립 5.0.0

관련 문제