What is the meaning of the method to_param?

Hey!

Foe example i have next code:

test "should update user" do   put :update, id: @user.to_param, user: @input_attributes   assert_redirected_to users_path end

What return id: @user.to_param?

to_param return the representaion of the object in the context of url params. ActiveRecord objects (like your @user) respond to to_param with their id.

That means, @user.to_param == @user.id

You can override this by defining the method in your ActiveRecord class (this is just a example, dont do this way):

def to_param

self.name

end