Skip to content

[Bug] ID of a relationship not reading the overridden ID attribute on the serializer of the relationship #2178

Closed
@dasnixon

Description

@dasnixon

Version: 0.10.6 - Expect the ID of the relationship to first be read from the serializer, then the object.

There is no issue on 0.10.4

I can help whip up a PR soon, just don't have the time at this moment. Figured you could fix this pretty quick (if it's a bug).

module Api
  module V1
    class QuoteSerializer < ActiveModel::Serializer
      attributes :id, ...
      ...
      # uses friendly_id gem
      belongs_to :adventure,
        serializer: Api::V1::AdventureSerializer
      ...
    end
  end
end
module Api
  module V1
    class AdventureSerializer < ActiveModel::Serializer
      attributes :id, ...
      ...
      def id
        object.to_param
      end
      ...
    end
  end
end

From 0.10.4
0 10 4

From 0.10.6
0 10 6

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions