ruby on rails - image saved but missing using paperclip -
i using paperclip @ attach images offers in rails application. code works in development, not in staging. in staging, images saving correctly s3, image_file_name nil.
db/migrate/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 app/models/offer.rb
class offer < activerecord::base attr_accessor :image has_attached_file :image, styles: { thumb: '100x100>', square: '200x200#', medium: '300x300>' } when run following configuration in development mode works, when switch staging following error:
paperclip::error (offer model missing required attr_accessor 'image_file_name'): if add attr_accessor :image_file_name model completes , image saves s3, attribute nil in database.
be sure migrate database. also, if you're using heroku you'll need restart service: model missing required attr_accessor 'photo_file_name' when uploading paperclip , s3 on heroku
Comments
Post a Comment