我有两个值@details和@users,如下所示
@details = ProjectTeamDetail.find_all_by_project_id_and_stage_id($projectID, stage.stage_id)
@users = User.find(:all)
ProjectTeamDetail Model具有user_id列
我的要求是让用户表中的用户不在@details中。希望你了解我的要求。
答案 0 :(得分:0)
Rails 3路:
@details = ProjectTeamDetail.where(project_id: $projectID, stage_id: stage.stage_id)
@users = User.all.where("id NOT IN (?)", @details.map(&:id))