I have two models, ParentProfile
and RoomParentAssignment
:
class ParentProfile < ActiveRecord::Base
has_many :room_parent_assignments
and
class RoomParentAssignment < ActiveRecord::Base
belongs_to :room_parent_profile, class_name: 'ParentProfile', foreign_key: 'parent_profile_id'
I would like to retrieve all ParentProfile
records where there are no room_parent_assignments
. I'm looking for something like the following statement (which needless to say, is invalid):
@non_room_parents = ParentProfile.where(!room_parent_assignments.present?)
How would I do this?