0

Hey all i'm getting hung up on how to search a database for a specific key pair. What i'm doing is sending a combine array of objects that represent data not sent for that user for the day. Here is the basic logic

Unless the database contains the object_id and user_id insert it into the array

The association is many objects to many users.

Is their a way to search the table cases_users so that it is a query like this

unless cases_users.contains? {object_id, user_id} objectarray.push(object_id)

4

1 回答 1

0

我想你想要

objectarray.push(object_id) unless User.find_by_object_id_and_user_id(object_id, user_id)
于 2013-01-17T22:58:18.003 回答