Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

find_or_create_by_ methods do not execute their block on first call

#1224

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.

Reported by Ken Miller · October 16th, 2008 @ 02:08 AM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Repository
    Repository
    • 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 find_or_create_by_ methods do not execute their block on first call state:committed] http://github.com/rails/rails/co...

    October 24th, 2008 @ 08:38 PM