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
2013/4/12 Dmitrij B. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
> 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?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
Ricardo Franco Andrade
( Web | Desktop | Game ) Developer
email: ricardo.krieg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
phone: +55 (86) 9436 0830
linkedin: http://www.linkedin.com/pub/ricardo-franco/61/2b0/857
skype: ricardo.krieg
github: https://github.com/ricardokrieg
twitter: twitter.com/ricardokrieg
facebooK: https://www.facebook.com/krieg.ricardo
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.