Home>

I want to apply fuzzy search in production environment regardless of capital letters and small letters in User search.
Fuzzy search (% # {search}%) is applied in the local environment.

Code
<% = text_field_tag: search, params [: search], class: 'search-form', placeholder: 'user search'%>
<% = button_tag sanitize ('<i></i>search'),: type =>"submit",: class =>"btn btn-primary"%>
def index
  @users = User.search (params [: search])
end
def self.search (search)
  if search
    User.where (['name LIKE?', "% # {Search}%"])
  else
    User.all
  end
end


I thought about using arel_table, but I don't know if it doesn't apply in the production environment even though it works well in the local environment.

  • Answer # 1

      

    I want to apply fuzzy search in production environment regardless of capital letters and small letters in User search.

    No such functionality isoriginally implementedin your code. It depends on the settings on the database server side.

Related articles

Trends