新手问题 有人对 parallel 这个包有研究吗,请教下

MarineJoker · March 03, 2019 · 901 hits
Parallel.each(User.all, in_processes: 8) do |user|
  user.update_attribute(:some_attribute, some_value)
end

其中关于 ActiveRecord 的并行,正常对 user 自身的属性进行操作不会出现问题,但是 假如 user 和 phone 是一对一关系 我在上述代码块中加入对 user.phone,或者 Phone.find_by_user_id(user.id) 的操作,这种通过 rails 的方法来找相关的对象时就会出现诸如 have a error uninitialized constant User::Phone 这类错误,这是为什么呢?和 rails 本身机制有关吗?

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.