paperclip error while reporcessing after rails 3 upgrade

后端 未结 2 1743
情书的邮戳
情书的邮戳 2020-12-16 08:17

I have paperclip working uploading and saving different styles for images but when i go to crop the image using jcrop from railscasts tutorial it doesnt crop image. I get

2条回答
  •  渐次进展
    2020-12-16 08:38

    Just as an addendum to the accepted answer (assuming you're following Ryan Bates' Railscast), you'll need to remove the following lines from your model:

    after_update :reprocess_avatar, :if => :cropping?
    
    def reprocess_avatar
      avatar.reprocess!
    end
    

    This will cause an infinite loop. You then just need to move the logic to the update action in the controller by adding something like this:

    if @user.cropping?
      @user.avatar.reprocess!
    end
    

    I got hung up on this for a while, so thought I'd share.

提交回复
热议问题