This project is archived and is in readonly mode.
find_or_create_by_ methods do not execute their block on first call
Reported by Ken Miller | October 16th, 2008 @ 02:08 AM | in 2.x
Because of the way find_or_create_by methods are autogenerated on first use, the initializer block is not properly passed on the very first invocation, though subsequent invocations work fine.
Attached patch includes a test and the fix, which is to explicitly capture and pass the block as an argument in method_missing.
Comments and changes to this ticket
-
Repository October 24th, 2008 @ 08:38 PM
- State changed from new to committed
(from [8a77c4abfa760e5829b566698400f2115409b7ff]) Fixed issue where block is not called on the very first invocation of a find_or_create_by_ automatic finder. [#1224 state:committed] http://github.com/rails/rails/co...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 1224 find_or_create_by_ methods do not execute their block on first call (from [8a77c4abfa760e5829b566698400f2115409b7ff]) Fixed i...