I have a simple model like
class Interest < ActiveRecord::Base has_and_belongs_to_many :user_profiles end class UserProfile < ActiveRecord::Base h
Try IN (?) and an array:
IN (?)
UserProfile.joins(:interests).where('interests.id IN (?)', [1,2,3,4,5])