Some problems trying to get this to work in Rails 4 - http://railscasts.com/episodes/182-cropping-images?view=comments
According to one of the questions in the comments: using the after_update callback to update the images, it ran into an infinite loop
Apparently the fix is ββto install @ user.avatar.reprocess! directly in the controller . However, I'm not sure exactly where in the controller this should go. And if I put this in the right place, will it work with rails 4?
I tried the following with no luck:
def create @user = User.new(user_params) if @user.save if user_params[:avatar].blank? @user.avatar.reprocess! flash[:notice] = "Successfully created user." redirect_to @user else render :action => "crop" end else render 'new' end end def update @user = User.find(params[:id]) if @user.update_attributes(user_params) if user_params[:avatar].blank? @user.avatar.reprocess! flash[:notice] = "Successfully updated user." redirect_to @user else render :action => "crop" end else render :action => 'edit' end end
ruby-on-rails jcrop paperclip
jonny_FIVE
source share