if the record is not found the find() throws an exception.

2012/6/19 John Merlino <[email protected]>

> Hey all,
>
> I saw this piece of code:
>
> @user = User.find(params[:user_id]) rescue nil
>
> why rescue with a nil here? If the user is not found, it will be nil
> anyway.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Fernando Almeida
www.fernandoalmeida.net

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to