Closed floriandejonckheere closed 1 year ago
I've got mixed feelings about this one. Could you explain the sort of scenario you're trying to prevent here?
I could see a case where you would want to merge
another serializer but override one or more of it's attributes. Ruby also lets you redefine methods.
I could see a warning maybe, but I'm not sure an ArgumentError
is the right solution here.
In hindsight, I think you are right. I spent some time finding a bug in a couple of serializers that turned out to be an overridden attribute. An error might impair functionality, but a warning could be welcome. I'll have a look at implementing this.
There hasn't been activity on this for a while and I'm not sure if this is something we really want to push ahead with. So I'm going to close it. I'm happy to reopen it if anyone feels differently though.
At the moment, if an attribute is redefined nothing special happens. The attribute still gets serialized, but the last definition will override the earlier in the final hash. Instead, the gem should warn the user when an attributes is redefined.