-
-
Save workmad3/6f7e7c9fac51aeeb800a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Export | |
module V1 | |
class GroupSerializer < ActiveModel::Serializers | |
attributes :items | |
def items_serializer | |
ItemsSerializer | |
end | |
def items | |
docs = object.items.order_by(:position.asc) | |
items_serializer.new(docs, special_options).serializable_hash | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Export | |
module V1 | |
class ItemsSerializer < ActiveModel::Serializer | |
# ... | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Export | |
module V2 | |
class GroupSerializer < ::Export::V1::GroupSerializer | |
def items_serializer | |
ItemsSerializer | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment