I have two arrays: one that contains ids and data values and one that
contains ids and names. There is a relationship between the ids in the
two arrays. How do I create a third array that contains names and data
values? This is basically a lookup to replace ids pulled from a
database with a readable name.
I’m using find to return to sets of data from a database that need to be
combined to display in an html table. The id is in one array, but the
corresponding name I need to display is in the other array because it’s
in another table. How do I combine them so I can display the name in
the table instead of the id?
Or is it better to do a join using rails so I only return a single set
of data from the database?