Fix deprecated arguments used in #sanitize

Failure/Error: d = sanitize(object.description, tags: "p, b, strong, em, i, a, u", attributes: "href, target")

     ArgumentError:
       You should pass :tags as an Enumerable
     # ./app/serializers/api/product_serializer.rb:26:in `description_html'
     # (eval):10:in `_fast_attributes'
     # ./app/services/products_renderer.rb:24:in `products_json'
     # ./app/controllers/api/order_cycles_controller.rb:14:in `products'
     # ./lib/open_food_network/rack_request_blocker.rb:36:in `call'
This commit is contained in:
Matt-Yorkley
2019-12-27 23:05:19 +01:00
committed by Luis Ramos
parent 04b760f221
commit b3e7f9a07e

View File

@@ -1,4 +1,4 @@
require 'open_food_network/scope_variant_to_hub'
require "open_food_network/scope_variant_to_hub"
class Api::ProductSerializer < ActiveModel::Serializer
include ActionView::Helpers::SanitizeHelper
@@ -23,7 +23,8 @@ class Api::ProductSerializer < ActiveModel::Serializer
# return a sanitized html description
def description_html
d = sanitize(object.description, tags: "p, b, strong, em, i, a, u", attributes: "href, target")
d = sanitize(object.description, tags: ["p", "b", "strong", "em", "i", "a", "u"],
attributes: ["href", "target"])
d.to_s.html_safe
end