I have a
table with a
field which contains the users full name.
I wrote a search function that should allow finding users by their first name or their last name, but it only returns results for first names.
For example if I have a user:
user.name = 'John Smith'
, if I enter 'John' I get the record back, but if I enter 'Smith' I get no results. Here's my search code:
name_users = User.where('name ILIKE ?', params["search_text"] + '%').all
How can I allow searching by last name?