mongoid でクエリを実行したい 、次のモデルがあります
class Score
include Mongoid::Document
field :value, :type => Integer
belongs_to :user
end
class User
include Mongoid::Document
field :name, :type => String
field :age, :type => Integer
has_many :scores
コレクションのすべてのスコアをユーザーと照会したいと考えています。ただし、ユーザーオブジェクトには「名前」フィールドのみが含まれている必要があります
私は次のようなものになります
Score.find.all.includes(:user).only(:name)
これの正しい構文を教えてください