moves html escaping to search_cache
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user