Alson you could just use where: @user = User.where(:id => params[:user_id]).first
On Wednesday, June 20, 2012 3:29:25 AM UTC+3, John Merlino wrote: > > 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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/QRvpn4dYbzcJ. 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.