Performing finds on the first two characters on any entry

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs