trailblazer/representable

Exception in Representable/deserializer

nonnenmacher opened this issue · 0 comments

Got a "no implicit conversion of Symbol into String" in deserialiser.rb line 102
where on the lambda StopOnExcluded the boolean construction that is :

  res = props.include?(options[:binding].name.to_sym)

where props is either an :include or :exclude param passed into Representable :options

Problem is that <String>.include?(<symbol>.to_sym) raise that exception as options[:binding].name is a Symbol already.

Does that line should be :

  res = props.include?(options[:binding].name.to_s)

instead ??

But it perhaps, my fault, as you expect actually an array of Symbol and its more like an API params mapping, where I pass something like :

    represent object, :with ...  :include "property name"

instead of

    represent object, :with ...  :include [:property_name, ...]

which is totally the case !
I'm closing the issue, as even an implied conversion of a String, when waiting for an array
is in fact an API adaptation burden, not a representer one, as the only way to pass multiple
:include or :exclude is with an array.

Sorry (ashamed ;-( )