I have a hash with members of an appointment and try to create a MySQL query in my rails controller. The users with the ids from the map command e.g. {1,3} should be excluded in the query. So for example @appointment.members.map{|m| m.user_id} returns {1,3,5} and I'd like to find all other users but these.
@users = User.where( "id NOT IN (?)", @appointment.members.map{|m| m.user_id} )
I'm using Rails 3.2.9 so maybe my exclude statement is wrong cause I don't get any result out of this query. The problem can't be the map array - I already tested that. Thanks in advance.
@appointment.membersreally a Hash or do you mean that it's ahas_manyrelationship?