I've some problem with an SQL Query
I've users which have skills
def skills=(value)
super(value.reject(&:blank?).join("|")) if !value.nil?
end
def skills
super.present? ? super.split("|") : []
end
Here is my problem. When I query on this field with "like", word order matter. How can I avoid that ?
User.where("skills LIKE '%car%driving_license%'")
Each user with skills which at least contain car and driving_license
User.where("skills LIKE '%driving_license%car%'")
Each user with skills which at least contain car and driving_license but in a different order
I want to be able to avoid this order problem. Any help ?
skillsstring in your Ruby code, and then check each skill against a list of accepted skills, e.g.WHERE skill1 IN ('driving_license', 'car') AND skill2 IN ('driving_license', 'car') AND ...