Login
Roast topics
Find topics
Find it!
From:
kevinjmurphy.com
(Uncensored)
subscribe
Finding an Initially Confusing Result in Rails - Kevin Murphy
https://kevinjmurphy.com/posts/find-or-initialize-by-block/
links
backlinks
Roast topics
Find topics
Roast it!
Rails' find_or_initialize_by method accepts an optional block, but that block is only executed when an existing record is not found by the provided attributes.