I have a simple form, where I set up a query that I want to browse, for example panasonic viera. This is on how I search the term in database:
P
If you're using PostgreSQL, you can use pg_search gem. It's support full text search, with option any_word
:
Setting this attribute to true will perform a search which will return all models containing any word in the search terms.
Example from pg_search
:
class Number < ActiveRecord::Base
include PgSearch
pg_search_scope :search_any_word,
:against => :text,
:using => {
:tsearch => {:any_word => true}
}
pg_search_scope :search_all_words,
:against => :text
end
one = Number.create! :text => 'one'
two = Number.create! :text => 'two'
three = Number.create! :text => 'three'
Number.search_any_word('one two three') # => [one, two, three]
Number.search_all_words('one two three') # => []