test/fixtures/poro.rb in active_model_serializers-0.9.11 vs test/fixtures/poro.rb in active_model_serializers-0.9.12
- old
+ new
@@ -142,18 +142,18 @@
attributes :name
end
class SelfReferencingUserParentSerializer < ActiveModel::Serializer
attributes :name
- has_one :type, serializer: TypeSerializer, embed: :ids, include: true
+ has_one :type, serializer: TypeSerializer, embed: :ids, embed_in_root: true
end
class SelfReferencingUserSerializer < ActiveModel::Serializer
attributes :name
- has_one :type, serializer: TypeSerializer, embed: :ids, include: true
- has_one :parent, serializer: SelfReferencingUserSerializer, embed: :ids, include: true
+ has_one :type, serializer: TypeSerializer, embed: :ids, embed_in_root: true
+ has_one :parent, serializer: SelfReferencingUserSerializer, embed: :ids, embed_in_root: true
end
class UserInfoSerializer < ActiveModel::Serializer
has_one :user, serializer: UserSerializer
end
@@ -174,9 +174,10 @@
end
class PostSerializer < ActiveModel::Serializer
attributes :title, :body
+ alias_method :title, :title # silence method redefinition warning
def title
keyword = serialization_options[:highlight_keyword]
title = object.read_attribute_for_serialization(:title)
title = title.gsub(keyword,"'#{keyword}'") if keyword
title