This project is archived and is in readonly mode.

#6613 ✓committed
Josh Susser

add first_bang to AR

Reported by Josh Susser | March 24th, 2011 @ 05:03 AM | in 3.1

Before scopes, controller methods did this:

@user = User.find(params[:id])

Now with scopes you can do

@user = User.where(:id => params[:id]).first

However that doesn't raise an exception when the record is not found. With this patch, you can do this:

@user = User.where(:id => params[:id]).first!

And that raises the RecordNotFound exception, as you'd expect.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>