binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.39k stars 134 forks source link

Passing an array to like_any changes the search field value #54

Open wksmall opened 14 years ago

wksmall commented 14 years ago

I've got a form like this:

<% form_for @search do |f| %>

Search <%= f.label(:source_like_any, "Source:") %> <%= f.text_field(:source_like_any, :size => '40') %> <%= f.submit("Search") %>

<% end %>

My controller does this:

def index options = params[:search] options['source_like_any'] = options['source_like_any'].to_s.split @search = MediaItem.searchlogic(options) @results = @search.all.paginate(:page => params[:page], :per_page => 20) end

I did this after watching Railscast #176 because I want to find all the words in any order.

The problem is that when the result form is displayed, the spaces are gone from the words in the search field. Resubmitting the search will get different results.

Any way around this or did I just miss something in the docs or Railscast?

yangjindong commented 14 years ago

I got the same problem.