I\'ve looked at some of the similar SO posts relating to this but I\'m struggling to get my head around it.
I have a habtm relation between Projects and Users. I\'m tryi
From Matt's reply above, which was extremely helpful.
I had trouble with this for a while. I attempted to use the following:
scope :not_belonging_to, lambda {|developer| where('id NOT IN (?)', developer.projects.empty? ? '' : developer.projects) }
But I received the following error:
SQLite3::SQLException: only a single result allowed for a SELECT
that is part of an expression:
I found I needed to update the scope, adding .ids on the end. See below:
scope :not_belonging_to, lambda {|developer| where('id NOT IN (?)', developer.projects.empty? ? '' : developer.projects.ids) }