I'd like to search the whole string in join columns. I have table products with columns: design, color, code and in index page I show them in one place using model method:
def name
[design.name, color, code_name(code)].join(' ').to_s
end
I would like to search in this join column. For example: Join column is: "Strips Black Plain" And when if I will type in search field "Strips Bl" I want to get all matching srings. For instance: Strips Black Plain2, Strips Blue Plain, etc.
When I had search in one column I used model method:
def self.search(letter)
if letter
where("colorLIKE ?", "%#{letter}%").order(:created_at)
else
all
end
I know I can search at the same time in several columns but separately using operator ||. But how search in this join column like in one column?