Я хочу получить id
респондентов, которые не ответили ни на один вопрос.Как мне это сделать?
Ниже приведены мои модели и их связи друг с другом.
Модель ответа (поля: id, query_id, text):
class Answer < ActiveRecord::Base
belongs_to :inquiry
belongs_to :question
has_one :respondent, :through => :inquiry
validates_uniqueness_of :inquiry_id
validates_presence_of :text
end
Модель респондента (поля: id, email, user_id):
class Respondent < ActiveRecord::Base
has_many :inquiries, :dependent => :destroy
has_many :questions, :through => :inquiries
belongs_to :user
validates_uniqueness_of :email
validates_presence_of :email
end
Модель запроса (поля: id, question_id, responsedent_id):
class Inquiry < ActiveRecord::Base
belongs_to :question
belongs_to :respondent
has_one :answer, :dependent => :destroy
Модель вопроса (поля: id, текст):
class Question < ActiveRecord::Base
has_many :inquiries, :dependent => :destroy
has_many :answers, :through => :inquiries, :dependent => :destroy
belongs_to :user
end