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

View File

@@ -61,7 +61,7 @@ class Proposal < ActiveRecord::Base
tag_list.join(' ') => 'B',
geozone.try(:name) => 'B',
summary => 'C',
description_text => 'D'
description => 'D'
}
end
@@ -69,10 +69,6 @@ class Proposal < ActiveRecord::Base
self.pg_search(terms)
end
def description_text
ActionController::Base.helpers.sanitize(description, tags: [])
end
def description
super.try :html_safe
end