Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ActiveModelSerializerのこう書きたい
class HogeSerializer < ActiveModel::Serializer
attributes :id, :hogehoge
has_many :fugas do |fuga|
fuga.attributes :id, :fugafuga
fuga.has_many :bars do |bar|
bar.attributes :id, :barbar
end
end
end
class HogeSerializer < ActiveModel::Serializer
attributes :id, :hogehoge
has_many :fugas
class FugaSerializer < ActiveModel::Serializer
attributes :id, :fugafuga
has_many :bars
class BarSerializer < ActiveModel::Serializer
attributes :id, :barbar
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.