This project is archived and is in readonly mode.

#3166 ✓committed

[PATCH] ActiveRecord::Base#reload didn't respect default_scope conditions

Reported by Tobi | September 8th, 2009 @ 03:24 PM

Just a quick bug fix for reloading a model which has a default_scope set but doesn't meet the condition:

It lead to a RecordNotFound exception, in case the model didn't met the default_scope condition (anymore) - this was obviously a bug. This quick fix makes use of with_exclusive_scope in the reload method to return the updated model in any case. See test for full example.

Cheers Tobi

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>

Referenced by