0

I have this code:

get_users('GET', []) ->
    Users = boss_db:find(consumer, []),
    {json, [{users, Users}]}.

But my users contains for example password field which I don't want to render. How to exclude some fields from rendring?

cnaize
  • 3,139
  • 5
  • 27
  • 45

1 Answers1

0

I'm not familiar with ChicagoBoss at all. What's the data type for the return value of the boss_db:find/2 function? Assuming Users is a list of records, I guess you could do something like:

Users0 = boss_db:find(consumer, []),
Users = [U#user{password = ""}|| U <- Users0],
{json, [{users, Users}]}.
Roberto Aloi
  • 30,570
  • 21
  • 75
  • 112