Forum: Ruby on Rails Performing finds on the first two characters on any entry

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
4afa9f703da7248c956addd9358cf432?d=identicon&s=25 ne ho (revanche)
on 2007-06-25 20:10
I have a basic find request where I am retrieving any records that match
the first and last name provided in an earlier form. It's almost like a
directory lookup.

@master = Master.find(params[:id],  :conditions => {
:firstname => @contact.firstname,
:lastname => @contact.lastname})

What I can't figure out, however, is how to perform the find to handle
name variations. For instance, Mike vs. Michael or Kate vs. Katie.

While it's not perfect, I'd like to get closer to the result by having
the find pull all records that have an identical last name and begin
with the first two characters of the first name provided. I tried a few
variations, but I'm getting hung up on how to find something that is not
an exact match.

Any suggestions would be appreciated!
This topic is locked and can not be replied to.