User
関連モデルを持つモデルがありEnrollmentInformation
ます:
class User
include Mongoid::Document
has_one :enrollment_information
end
class EnrollmentInformation
include Mongoid::Document
belongs_to :user
field :type_one, :type => Boolean
end
EnrollmentInformation
のtype_one
フィールドの値が trueであるすべてのユーザーを検索したいと思います。
これについていくつかのバリエーションを試しましたが、成功しませんでした。このクエリを作成する方法を知っている人はいますか?
User.includes(:enrollment_information).where(:"enrollment_information.type_one" => true)
編集:
更新されたクエリ