我的模特是
class TelecomOperator < ActiveRecord::Base
has_many :users
class User < ActiveRecord::Base
belongs_to :telecom_operator
当我 TelecomOperator.first.users 时,它给了我所有用户但是当我做的时候 User.first.telecom_operator 它总是给我零
SELECT "users".* FROM "users" WHERE "users"."deleted_at" IS NULL AND "users"."id" = $1 LIMIT 1 [["id", 2]]
=> nil
当我这样做时
User.includes(:telecom_operator).find(2)
工作正常