好的,到目前为止我有这个搜索查询:
if Object.const_get(params[:model]).find(params[:id]) == @current_department
sent = Message.where(sender_username: params[:username], recipient_username: params[:username])
recieved = Message.where(recipient_username: params[:username])
end
现在我想recieved
稍微改变一下 -search 查询:
recieved = Message.where(recipient_username: params[:username])
类似于:
Message.where(sender_username: @current_department.employees.each { |f| f.username}, recipient_username: params[:username]}
但不知何故,我无法将多个用户名传递给搜索:
sender_username: @current_department.employees.each { |f| f.username}
我没有收到错误,但我的搜索查询仍然无法正常工作!我该如何更改我的查询?谢谢