I'm logging all impressions of a certain page, by saving each visit as a record in Impression
.
Impression
saves the user_id
if the visitor is logged in, hence some records have no user_id saved.
When querying the log to display number of visits I want to exclude the admins of the site.
The following is one way to exclude the admins, but it doesn't include records with no user_id atribute:
Impression.where("user_id NOT IN (?)", [1,2])
How can I, in Rails 3.2, do a query which excludes records with certain (multiple) attribute values?