Would this work?
@followingusers = whatever you have for users you are following
@notfollowingusers = User.where("id not in (?)", @followingusers.map(&:id))
Question
I'm working on a Sample Application that's similar to Michael Hartl's Railstutorial and would like to display all users that the current_user is not following. How can I do that?
User.rb is:
has_many :following_relationships, class_name: "Relationship", foreign_key: :follower_id
has_many :leading_relationships, class_name: "Relationship", foreign_key: :leader_id
Relationship.rb is:
belongs_to :follower, class_name: "User"
belongs_to :leader, class_name: "User"
Solution
Would this work?
@followingusers = whatever you have for users you are following
@notfollowingusers = User.where("id not in (?)", @followingusers.map(&:id))