I have an array of hashes that contains several fields, including
first_name and last_name. Unfortunately, since its the result of an API
call, I have no other ways to work with it. Regardless, I’m trying to
build a basic search function where a user can enter a name and it will
display the results from a newly created array.
I’m guessing that sort_by will be the best route to go, but I’ve been
unsuccessful in finding out how to use it with multiple fields. Any
guesses?
The second part to the question is how you structure the sort_by, if
that is the best way, to find objects that are similar to the requested
query. It’s not so much that a user would mispell a name (although that
would be helpful) but if they put in a firstname + lastname pair, it
wouldn’t technically match with either field on its own.
Thanks in advance.