I am not a Ruby developer but I have an application that I inherited that runs on it. I am getting the below error:
wrong number of arguments (given 1, expected 0)
Code having problem is:
def destroy
@user.destroy(params[:id]) #This is the line that my ArgumentError pointed to
respond_to do |format|
format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
format.json { head :no_content }
end
end
Any update to code or other places I need to look would be much appreciated.
I tried removing the (params) but that ended up creating other issue. I have read through other posts and did not see one using params
destroytakes no paramaters. You're already calling it on the instance variable.You may be confusing the class method with the instance method.