Rails 2.0 missing find_or_create_by_name and find_or_initialize_by_name

Hey.

just found out that Rails 2.0 (in the prerelease version) does not have the extended dynamic finders find_or_create_by_name and find_or_initialize_by_name

They are mentioned in the old 1.x docs ActiveRecord::Base (section "Dynamic attribute-based finders")

But I couldnt find it in the edge docs (http://caboo.se/doc.html)

Could somebody hint me at what to do? Did they move to a plugin? which? Are there lines I can implement myself?

Any help appreciated,

Thanks!

/Jesper

They're still there. Check out method_missing on ActiveRecord::Base. :slight_smile:

RSL

Thx Russel. But how come that it does not work. I get this error printed below. What can I do to make it work with the current pre-release?

/Jesper

DOH. Sorry. found out that my model PoliceJournal did not have "name" I should have used PoliceJournal.find_or_initialize_by_number

DOH. Sorry to have interrupted you.