title: Rails: Getting an array of object ids by query/conversion (for comparision)
body: <p>Basically, I want an array of ids from the database. </p>
  
  <p>Some background:</p>
  
  <ul>
  <li>I'm rendering a list of objets (foos) to the user with a checkbox. </li>
  <li>If the user checks the box a row is create in a different table (bar)</li>
  <li>when rendering the foo list + checkbox I want to check if the unique id any given foo already exists in the bar id array. </li>
  </ul>
  
  <p>I assumed that getting an array of ids would be much more efficient than querying the database for each instance of foo when rendering the foo list with checkboxes. </p>
  
  <p>Ideas? Apologies in advance if this is not clear. </p>