I am currently experimenting using the ransack gem
to conduct a search on a model in Rails. As it stands I am using the basic setup.
Controller:
def index
@q = Person.search(params[:q])
@people = @q.result(:distinct => true)
end
View:
<%= search_form_for @q do |f| %>
<%= f.label :name_cont %>
<%= f.text_field :name_cont %>
<%= f.submit %>
<% end %>
I have managed to find lot of information about conducting searches on multiple fields, however, I haven't managed to find anything to help me to split up the :q
parameter and thereby enable me to search for each of the (unknown quantity of) words in the search string entered in the form of search for ??? AND ??? AND ??? ...
, rather than searching for the entire string in one section
Is anybody able to point me in the right direction?