Replace outdated ActiveModel::Serializers by Panko::Serializer#1139
Replace outdated ActiveModel::Serializers by Panko::Serializer#1139casperisfine wants to merge 1 commit intomainfrom
Conversation
ad3923c to
b31b185
Compare
Upstream accepted the patch very quickly. There is still a minor limitation as it only work for regular attributes, relations can't be skipped. But I think it's probably fine. It just means a couple of API fields will be explicitly Overall the integration was super easy, I'm just a bit worried because the test coverage of the serializers is relatively limited, so It's not unlikely I missed some difference between the two serailizers. |
b31b185 to
6ff5b33
Compare
6ff5b33 to
fc08c1b
Compare
fc08c1b to
9652dc7
Compare
|
Ok, so I found another big issue. class Stack < AR::Base
def repo_name
repo.name
end
end
class StackSerializer << Panko::Serializer
attributes :repo_name
end
stack.repo_name # => "Some String"
StackSerializer.new.serailize(stack).to_json # => '{"repo_name": null}'I think I can get this handled upstream, but ultimately I'm getting a bit uncomfortable with the I might look for another gem. |
Most of the code was super easy to convert.
So far I've found one blocker:
There's no way to conditionally include attributes. Best we can do is to have anullvalue.I'll see if I can get that feature added upstream.