Cleaner unsuffixed association keys tests

This commit is contained in:
Gauthier Delacroix
2014-10-08 16:51:44 +02:00
parent 226cbc4160
commit a39d08d2ad
3 changed files with 22 additions and 16 deletions

22
test/fixtures/poro.rb vendored
View File

@@ -142,3 +142,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