I was going through the Clearance source code and I found this expression to be curious:
def user_from_params user_params = params[:user] || Hash.new email = user_params.delete(:email) password = user_params.delete(:password) #... end
Is there a reason for assigning the params to local variables by calling delete? I discussed this with @halogenandtoast in the Campfire room once, but I am still curious about it.
Part of what makes strange for me is using a destructive operation for assignment, I guess it makes reading a little awkward. Is there an advantage to using delete?