2013-05-21 2 views
0

내 레일 응용 프로그램의 이미지에 첨부 이미지에 클립 클립을 사용하고 있습니다. 코드는 개발 단계에서 작동하지만 준비 단계에서는 작동하지 않습니다. 스테이징에서 이미지는 s3에 올바르게 저장되지만 image_file_name은 nil입니다.이미지가 저장되었지만 종이 클립을 사용하여 누락되었습니다.

dB/마이그레이션은/20130507182116_add_image_to_offers.rb

class AddImageToOffers < ActiveRecord::Migration 
    def self.up 
    add_attachment :offers, :image 
    end 

    def self.down 
    remove_attachment :offers, :image 
    end 
end 

응용 프로그램/모델/offer.rb

class Offer < ActiveRecord::Base 
    attr_accessor :image 

    has_attached_file :image, styles: { 
    thumb: '100x100>', 
    square: '200x200#', 
    medium: '300x300>' 
    } 

나는 그것이 작동 개발 모드에서 다음 구성을 실행, 때 준비로 전환 다음 오류가 발생합니다.

Paperclip::Error (Offer model missing required attr_accessor for 'image_file_name'): 

모델에 attr_accessor :image_file_name을 추가하면 이미지가 완료되고 이미지는 s3으로 저장되지만 데이터베이스의 속성은 nil입니다.

답변

관련 문제