Watched 1 video

Watched 1 Video from start to finish

Subscribed for 1 month

Learning and showing your support for 1 Month

Spread the word 1 time

Referred 1 Member to Drifting Ruby

10

10 times Chatter Box

Make 10 comments to videos or replies to other comments
1/10

10

Share the love 10 times

Liked 10 episodes
1/10

3

Welcome back 3 times

You've visited Drifting Ruby on 3 different days

Suggested 1 episode

Helped the community by suggesting 1 episode

Vote Suggestion 1 time

Helped the community by voting on suggestions 1 time

Share the love 1 time

Liked 1 episode

Earned on 3/4/2019

1 time Chatter Box

Make 1 comment to videos or replies to other comments

Earned on 3/4/2019

Sylor-huang said 11 months ago on Cropping Images with JCrop :

Thanks for your video, @kobaltz, but I have some problems with your codes , I used rails 4.2.8 , ruby 2.5.0 .

In my users_controller.rb , I write the updatelike this :

def update
    @user = User.find(params[:id])
    if @user.update_attributes(user_params)
      if params[:user][:picture].present?
        render :crop
      else
        redirect_to @user, notice: "Success update"
      end
    else
      render :edit
    end
  end

and then I write the user_params like this :
```
private
def set_user
@user = User.find(params[:id])
end

def user_params
params.require(:user).permit(:name, :email, :phone, :password, :phoneMes, :picture, :crop_x, :crop_y, :crop_w, :crop_h, :password_confirmation)
end
```

But when I upload the image , it always jump to edit.html.erb without jump to crop.html.erb, this is for why ? Could you help me ? I had searched a long time , but it seems this no answer. Thanks so much ,@kobaltz.