Ruby on rails 4: Render and / or redirect called multiple times in action. using Devise

5

in my controller registrations_controller.rb in the update method, when you edit and make the changes it does not redirect me to the path I want but it flags me the error: DoubleRenderError Render and / or redirect were called multiple times in this action.

Is there anything I'm doing wrong with the redirect? this is my controller's method:

    def update
        super
        @user = User.find(user_params[:user][:id])
        user_params[:user].delete :id
        if user_params[:user][:password].blank?
          user_params[:user].delete :password
          user_params[:user].delete :password_confirmation
        end
    respond_to do |format|
          if @user.update_attributes(user_params['user'])
              format.html { redirect_to users_list_path, notice: 'Usuario modificado con éxito.' }
          else
            format.html { render :edit, notice: 'Error.' }
          end
        end
      end
    
asked by Israel Avilez 17.08.2016 в 19:38
source

1 answer

2

I could solve it. you only need to add a 'return'.

format.html { redirect_to users_list_path and return }
    
answered by 17.08.2016 в 21:50