Steve, are you thinking about something like this in terms of code?
render json: SearchClient.new(@clients)
#or
render json: ContractWon.new(@clients)
class SearchClient
def initialize(clients)
@clients = clients
end
def to_json(options=nil)
@clients.to_json(only: %w(foo bar)
end
end
class ContractWon
def initialize(clients)
@clients = clients
end
def to_json(options=nil)
@clients.to_json(only: %w(baz other)
end
end
That's basically the approach I've been using lately, and it works quite fine for my needs :).