<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>liuminhan (刘艾伦)</title>
    <link>https://ruby-china.org/liuminhan</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>homeland 应用 log, 在哪个地方可以看到？</title>
      <description>&lt;p&gt;用 docker-compose 部署了 homeland 之后，只看到了 nginx 相关的 log, 没有看到 puma 的 log,  现在想看下 PushJob 触发之后相应的 logger, 不知道在哪里可以看到？
&lt;a href="/huacnlee" class="user-mention" title="@huacnlee"&gt;&lt;i&gt;@&lt;/i&gt;huacnlee&lt;/a&gt; 还请告知一下&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Tue, 05 Jan 2021 22:42:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/40782</link>
      <guid>https://ruby-china.org/topics/40782</guid>
    </item>
    <item>
      <title>PostgreSQL 频繁的插入操作，导致其它请求超时</title>
      <description>&lt;p&gt;rails 应用，有一个异步任务，大批量插入数据，结果导致了其它的查询请求都超时了。这是数据库的连接池的设置问题，还是服务器的并发问题？&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Tue, 31 Mar 2020 12:02:14 +0800</pubDate>
      <link>https://ruby-china.org/topics/39684</link>
      <guid>https://ruby-china.org/topics/39684</guid>
    </item>
    <item>
      <title>format 保留的两位小数，是五舍六入？</title>
      <description>&lt;p&gt;使用 format('%.2f', 4.565) 保留两位小数跟 4.565.round(2).to_s 的结果不一样&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'%.2f'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;4.565&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;4.56&lt;/span&gt;
&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'%.2f'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;4.566&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;4.57&lt;/span&gt;

 &lt;span class="mf"&gt;4.565&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;  &lt;span class="mf"&gt;4.57&lt;/span&gt;
 &lt;span class="mf"&gt;4.566&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;  &lt;span class="mf"&gt;4.57&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;</description>
      <author>liuminhan</author>
      <pubDate>Mon, 06 Jan 2020 15:34:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/39409</link>
      <guid>https://ruby-china.org/topics/39409</guid>
    </item>
    <item>
      <title>关于 bootsnap-compile-cache 目录太大的问题</title>
      <description>&lt;p&gt;rails 5.2, 使用 capistrano 部署，tmp/cache/bootsnap-compile-cache 增长特别大，达到了 20 多个 G，大家一般都是怎么处理的？&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Wed, 06 Nov 2019 19:03:56 +0800</pubDate>
      <link>https://ruby-china.org/topics/39224</link>
      <guid>https://ruby-china.org/topics/39224</guid>
    </item>
    <item>
      <title>表中只有两个 id 字段的优化问题</title>
      <description>&lt;p&gt;最近在做一个功能，供货商给他的客户去绑定货品。用一张表去存储客户绑货这个关系，用到了两个字段&lt;code&gt;customer_id, goods_id&lt;/code&gt;,  如果一个客户绑定了 500 个货品，就会产生 500 条记录。这样到了 1000 个供货商的时候，如果每个供货商又有 500 个客户，每个客户绑定 500 个货品，那么就会产生 1000 * 500 * 500 = 250,000,000(2.5 亿) 条记录，这种情况下是不是应该把 goods_id 序列化成一个数组字段会更好？&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Thu, 04 Jul 2019 18:19:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/38787</link>
      <guid>https://ruby-china.org/topics/38787</guid>
    </item>
    <item>
      <title>GitHub 可以免费创建私有仓库了</title>
      <description>&lt;p&gt;&lt;a href="https://blog.github.com/2019-01-07-new-year-new-github/" rel="nofollow" target="_blank"&gt;https://blog.github.com/2019-01-07-new-year-new-github/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;github 个人可以免费创建私有仓库了，仓库最多可邀请 3 个人协作&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Tue, 08 Jan 2019 09:30:39 +0800</pubDate>
      <link>https://ruby-china.org/topics/37980</link>
      <guid>https://ruby-china.org/topics/37980</guid>
    </item>
    <item>
      <title>关于权限控制的问题</title>
      <description>&lt;p&gt;最近在弄权限相关的东西，一般是引入 pundit 或者 cancancan。但是比如说在移动端，根据分配的权限来决定显示什么模块，不涉及到跳转或者能不能操作 Resource 之类的，像这种情况下，是不是没必要引入权限控制，只需要存一个权限的名称，有这个名称的，就可以显示相应模块。&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Thu, 14 Jun 2018 11:51:41 +0800</pubDate>
      <link>https://ruby-china.org/topics/36946</link>
      <guid>https://ruby-china.org/topics/36946</guid>
    </item>
    <item>
      <title>字符串全局替换时，如何跳过不想替换的字符串</title>
      <description>&lt;h4 id="问题描述"&gt;问题描述&lt;/h4&gt;
&lt;p&gt;有个文本内容像下面这样，&lt;/p&gt;

&lt;p&gt;&lt;code&gt;关于ruby方面的问题,可以到&amp;lt;a href='https://ruby-china.org'&amp;gt;ruby-china&amp;lt;/a&amp;gt;上搜索相关资料&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;我想全局替换 ruby 这个词，给它链接到 &lt;code&gt;https://ruby-lang.org&lt;/code&gt;, 但是我又不想把已经有超链接包住的 ruby-china 中的 ruby 给替换了，有什么办法吗？我全局替换用的 gsub，想不到有什么好办法实现这个功能。&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Thu, 22 Mar 2018 18:27:54 +0800</pubDate>
      <link>https://ruby-china.org/topics/35297</link>
      <guid>https://ruby-china.org/topics/35297</guid>
    </item>
    <item>
      <title>控制器与视图之间共享不超过两个实例变量</title>
      <description>&lt;p&gt;&lt;a href="https://github.com/JuanitoFatas/rails-style-guide/blob/master/README-zhCN.md#shared-instance-variables" rel="nofollow" target="_blank" title=""&gt;rails 风格指南&lt;/a&gt;里说控制器与视图之间共享不超过两个实例变量，主要是因为什么原因会建议不超过两个实例变量？&lt;/p&gt;

&lt;p&gt;参考&lt;a href="https://thoughtbot.com/upcase/videos/encapsulation-and-global-state-in-rails" rel="nofollow" target="_blank" title=""&gt;这篇文章&lt;/a&gt;，一个原因是实例变量在 before_filter 这样的方法里，会被设置与修改，如果忘记了 before_fitler 做的一些操作，这样在 action 中的实例变量的值可能跟预期不一样，对 debug 之类的产生干扰，这个不知道是不是主要原因？&lt;/p&gt;</description>
      <author>liuminhan</author>
      <pubDate>Fri, 12 Jan 2018 10:49:04 +0800</pubDate>
      <link>https://ruby-china.org/topics/34872</link>
      <guid>https://ruby-china.org/topics/34872</guid>
    </item>
  </channel>
</rss>
