Skip to content

Instantly share code, notes, and snippets.

@twilson63
Created June 19, 2009 09:14
Show Gist options
  • Save twilson63/132522 to your computer and use it in GitHub Desktop.
Save twilson63/132522 to your computer and use it in GitHub Desktop.
@people = People.find(:all) do
any do
if !criteria.numeric?
all do
first_name =~ criteria.split(' ')[0] + '%'
last_name =~ criteria.split(' ')[1] + '%' if criteria.split(' ').length > 1
end
all do
last_name =~ criteria.split(' ')[0] + '%'
first_name =~ criteria.split(' ')[1] + '%' if criteria.split(' ').length > 1
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment