ruby on rails 4 - where.not() not working on arrays -
i have array called user_ids , want select records user_ids not in array.
here used:
mymodel.where.not(user_id: user_ids)
but got error wrong number of arguments (0 1)
.
same thing happens when used mymodel.where.not('user_id=?', user_ids).
thought maybe becuase array empty, same thing happens arrays not empty.
does know why happens?
i using rails 4.
you should try this:
mymodel.where('user_id not in (?)', user_ids)
Comments
Post a Comment