From: Sam Ginko Date: 2008-06-26T22:21:39+09:00 Subject: search query question I'm not using ferret because the search I need is not that complicated. I created a basic active record search. I'm using some code from the pragmaticprogrammer book. This is the issue: I can get the single keyword to work fine when entered into the search box, but when you put to keywords separated by a space the search returns no results. It makes sense since the function below was structured for a single key search. So I tried to modify it by getting the string, splitting it and trying to do a loop for the newly splitted string. Here is when I get the error "can't convert Array into String". I'm sure that I'm doing some logical mistakes but I'm new to ruby on rails so please forgive me. hope some one can help def conditions_by_like(value, *columns) myArray = value.gsub(/[^\A-Za-z0-9\s]/, "").split(/ /) myArray.each do |itemz| columns = self.user_columns if columns.size==0 columns = columns[0] if columns[0].kind_of?(Array) conditions = columns.map { |c| c = c.name if c.kind_of? ActiveRecord::ConnectionAdapters::Column "`#{c}` LIKE " + ActiveRecord::Base.connection.quote("%#{itemz}%") }.join(" OR ") end end -- Posted via http://www.ruby-forum.com/.