Just a reminder: it's just specific with the find(). find_by_* will return
nil unless you add a ! (e,g,, find_by_name!()) then it also returns the
exception

On Wed, Jun 20, 2012 at 8:55 AM, John Merlino <stoici...@aol.com> wrote:

> ok I thought it would return nil
>
> thanks for response
>
> On Jun 19, 8:33 pm, Fernando Almeida <ferna...@fernandoalmeida.net>
> wrote:
> > if the record is not found the find() throws an exception.
> >
> > 2012/6/19 John Merlino <stoici...@aol.com>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > 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 rubyonrails-talk@googlegroups.com
> .
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=en.
> >
> > --
> > Fernando Almeidawww.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 rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to