Forum: Ruby on Rails find_or_create_by_name

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ead43bcb0202410540a6a7cee5955d46?d=identicon&s=25 Fresh Mix (giga)
on 2008-12-11 17:17
If I have a table: (id, lastname, firstname), can I use
"find_or_create_by_name" if I have to search by first and last name?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-11 17:23
(Received via mailing list)
On 11 Dec 2008, at 16:17, Gi Ga wrote:

>
> If I have a table: (id, lastname, firstname), can I use
> "find_or_create_by_name" if I have to search by first and last name?

no. find_or_create_by_foo requires foo to be an actual column (but you
can do find_or_create_by_foo_and_bar)

Fred
This topic is locked and can not be replied to.