oj_serializers
oj_serializers copied to clipboard
Can't name has_one associated ':options'
has_one :options doesn't seem to work—however, as a workaround, the following does work:
class MyThingSerializer < Oj::Serializer
has_one :_options, as: :options, serializer: MyFancyOptionsSerializer do
my_thing.options
end
end
Any ideas behind the source of this strange behaviour?
it seems the serializer class have an instance method called options already which use to accept options for the seriazlier. need to use other name since options is already taken.