moves html escaping to search_cache

This commit is contained in:
kikito
2016-02-03 18:39:07 +01:00
parent 986919503a
commit b1534c1f56
2 changed files with 7 additions and 6 deletions

View File

@@ -20,11 +20,16 @@ module SearchCache
end
def set_tsvector(value, weight)
"setweight(to_tsvector('spanish', unaccent(coalesce(#{quote(value)}, ''))), #{quote(weight)})"
"setweight(to_tsvector('spanish', unaccent(coalesce(#{quote(strip_html(value))}, ''))), #{quote(weight)})"
end
def quote(value)
ActiveRecord::Base.connection.quote(value)
end
def strip_html(value)
ActionController::Base.helpers.sanitize(value, tags: [])
end
end