yosiat / panko_serializer

High Performance JSON Serialization for ActiveRecord & Ruby Objects
https://panko.dev
MIT License
592 stars 36 forks source link

Keep alias_name when method_added (#135) #136

Closed hkdnet closed 1 year ago

hkdnet commented 1 year ago

method_added removes the same name attribute from attributes and add a new one to method_fields. It ignores alias_name of the original attribute. Then the alias setting does not work with method fields.

With this patch, the original alias_name is kept.

In addition, serialize_method_fields does not use attr_name_for_serialization unlike other serialize functions. This patch also fixes it to use the function.