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 `update `like 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.
I'm trying to do this, but I'm using Devise for users and my users controller doesn't like that I don't have any info for the edit method. Is there anyone that can help?
You could try to change the controller endpoint so it's not going to devise, but rather a user controller. So you wouldn't use the `edit_user_registration_path` in the view, but rather something like edit_user. With Devise, you may need to add something like `bypass_sign_in(current_user)` as it will sometimes log a user out on changes. So the edit action of the UsersController may look like this.
```
def update
if current_user.update_attributes(user_params)
bypass_sign_in(current_user)
if params[:user][:avatar].present?
render :crop
else
redirect_to edit_user_path(current_user), notice: "Successfully updated user."
end
else
render :edit
end
end
```
Can you Please implement the cropping for cloudinary images?
I am using cloudinary for image uploads and I used the same approach as you mentioned but my images are not getting cropped?
Please help!
Thank you very much, I was looking for it.
gruvbox for sublime text. It is also available for VIM, RubyMine, etc.
Thanks!