mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge pull request #639 from gauthier-delacroix/Unsuffixed-default-associations-keys
Allow JSONAPI unsuffixed associations keys
This commit is contained in:
22
test/fixtures/poro.rb
vendored
22
test/fixtures/poro.rb
vendored
@@ -148,3 +148,25 @@ module TestNamespace
|
||||
class ProfileSerializer < ::ProfileSerializer; end
|
||||
class UserSerializer < ::UserSerializer; end
|
||||
end
|
||||
|
||||
ActiveModel::Serializer.setup do |config|
|
||||
config.default_key_type = :name
|
||||
end
|
||||
|
||||
class NameKeyUserSerializer < ActiveModel::Serializer
|
||||
attributes :name, :email
|
||||
|
||||
has_one :profile
|
||||
end
|
||||
|
||||
class NameKeyPostSerializer < ActiveModel::Serializer
|
||||
attributes :title, :body
|
||||
|
||||
has_many :comments
|
||||
end
|
||||
|
||||
ActiveModel::Serializer.setup do |config|
|
||||
config.default_key_type = nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user