I am trying to limit which children get displayed in the json response at the serializer level. If a currency is marked as 'active' the currency should be included in the payload for Merchant. If the currency is 'inactive' the GET on merchant should not be included.
class MerchantSerializer < ActiveModel::Serializer
attributes :id, :merchant_name, :merchant_type, :currencies
class MerchantCurrencyMapSerializer < ActiveModel::Serializer
attributes :id, :currency, :b4flight_id, :aht_account_id, :created_at, :updated_at, :guess_merchant
If I'm understanding your question correctly, you want
has_many :merchant_currency_maps to only include currency maps that are active, right? You could try an override in your
def merchant_currency_maps object.merchant_currency_maps.where(active: true) end