I want to include a search functionality to my rails app. I have included a search by date that works just fine, however the search by name LIKE ?
isn't giving me any results.
I would like the name search to be a wildcard search.
Can anyone please tell me where I might be going wrong?
View for index.html.erb:
<%= form_tag(appointments_path, :method => "get") do %>
<%= text_field_tag :search, nil, :placeholder => "Search Full Name" %>
<%= text_field_tag :search, nil, :placeholder => "Search Date (YYYY-MM-DD)"%>
<%= submit_tag "Search" %>
<% end %>
Controller:
def self.search(search_for)
Appointment.where('name Like ?', search_for)
Appointment.where('date = ?', search_for)
end