<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>MarineJoker</title>
    <link>https://ruby-china.org/MarineJoker</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>有人对 parallel 这个包有研究吗，请教下</title>
      <description>&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;Parallel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;in_processes: &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update_attribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:some_attribute&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;some_value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;其中关于 ActiveRecord 的并行，正常对 user 自身的属性进行操作不会出现问题，但是
假如 user 和 phone 是一对一关系
我在上述代码块中加入对 user.phone，或者 Phone.find_by_user_id(user.id) 的操作，这种通过 rails 的方法来找相关的对象时就会出现诸如 have a error uninitialized constant User::Phone
这类错误，这是为什么呢？和 rails 本身机制有关吗？&lt;/p&gt;</description>
      <author>MarineJoker</author>
      <pubDate>Sun, 03 Mar 2019 22:17:32 +0800</pubDate>
      <link>https://ruby-china.org/topics/38179</link>
      <guid>https://ruby-china.org/topics/38179</guid>
    </item>
    <item>
      <title>关于多线程的 gem 包，parallel 的问题</title>
      <description>&lt;p&gt;新手，最近在写批处理 rake 任务的时候发现效率太低，之后发现了 parallel，发现直接套 map_reduce 的思想就行了，然后去 rubygems 上没有发现该包的依赖关系，意思这包是可以直接运用在任何项目上的？&lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;/p&gt;</description>
      <author>MarineJoker</author>
      <pubDate>Sat, 02 Mar 2019 22:53:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/38178</link>
      <guid>https://ruby-china.org/topics/38178</guid>
    </item>
    <item>
      <title>有关 Sidekiq::Worker 的 perform_async 方法传入的参数的问题</title>
      <description>&lt;p&gt;新手写队列相关问题时，当向 perform_async 方法传递的参数为一个 model 对象的实例时，就会出现找不到实例的方法的错误，这是为什么？&lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;/p&gt;</description>
      <author>MarineJoker</author>
      <pubDate>Wed, 27 Feb 2019 00:06:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/38154</link>
      <guid>https://ruby-china.org/topics/38154</guid>
    </item>
  </channel>
</rss>
