Tuesday, September 1, 2009

Do not use Ruby's Enumerable find() method in Rails

According to ruby doc.

find enumObj.find {| obj | block } -> anObject or nil

Synonym for Enumerable#detect .

However if you ever try to use Enumerable#find in Rails, you'll get a "cannot find object without object id" error.

Better to use Enumerable#detect

No comments:

Blog Archive