Я использую ActiveModel::Serializers
, чтобы получить JSON в приложение Ember.js. Я использую боковое загрузку, чтобы максимизировать производительность.Многоуровневая hasMany боковая загрузка
Могу я сообщить ActiveModel::Serializers
, чтобы оставить все PhoneNumbers
в SwitchboardSerializer
?
switchboard_serializer.rb
class SwitchboardSerializer < ActiveModel::Serializer
embed :ids, :include => true
attributes :id, :name
has_many :switchboard_entries
has_many :sip_accounts, :through => :switchboard_entries
end
sip_account_serializer.rb
class SipAccountSerializer < ActiveModel::Serializer
embed :ids, :include => true
attributes :id, :auth_name, :caller_name, :sip_accountable_id
has_many :phone_numbers
end