<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>lulalala (lulalala)</title>
    <link>https://ruby-china.org/lulalala</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Rails 6.1 的 ActiveModel#errors 翻新</title>
      <description>&lt;p&gt;之前在这有发过两篇文（&lt;a href="https://ruby-china.org/topics/32827" title=""&gt;1&lt;/a&gt;, &lt;a href="https://ruby-china.org/topics/34577" title=""&gt;2&lt;/a&gt;），关于想改善 &lt;code&gt;ActiveModel#errors&lt;/code&gt;。后来 Rails 团队终于把改变给加进去 master 了，预计今年会以 Rails 6.1 的方式推出。在此想先介绍本次改变有什么 deprecation 跟 breaking changes。也希望在 6.1rc1 推出前，搜集一下大家的意见看看如何改进～&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.lulalala.com/2020/0619-1013.html" rel="nofollow" target="_blank"&gt;https://code.lulalala.com/2020/0619-1013.html&lt;/a&gt;&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Mon, 29 Jun 2020 09:18:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/40041</link>
      <guid>https://ruby-china.org/topics/40041</guid>
    </item>
    <item>
      <title>许多页面鼠标中键无作用</title>
      <description>&lt;p&gt;我发现在内文页，我按鼠标中键，并不会有操控页面上下移动的功能。
但是首页是正常的。
这边是用 Firefox&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Sun, 09 Dec 2018 16:34:00 +0800</pubDate>
      <link>https://ruby-china.org/topics/37875</link>
      <guid>https://ruby-china.org/topics/37875</guid>
    </item>
    <item>
      <title>Settei - 一個 Config 使用 YAML 卻又符合 12-factor app 的 Gem</title>
      <description>&lt;p&gt;嗨各位，我又来老王卖瓜了：&lt;/p&gt;

&lt;p&gt;Settei 是一个用来取代 Settingslogic/dotenv/figaro 的 gem，让你使用 YAML 管理你的配置，但是又能把 YAML 用 env var 的方式部署到远端，符合 Heroku 所宣传的 12-factor app 概念。&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/lulalala/settei" rel="nofollow" target="_blank"&gt;https://github.com/lulalala/settei&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="缘起"&gt;缘起&lt;/h2&gt;
&lt;p&gt;12-factor app 是一套让部属更容易的规则。其中第三点指到，要把配置跟程式分开，并把配置存在环境（变数）中。&lt;/p&gt;

&lt;p&gt;但是使用环境变数有很多缺点，要是你的程式有 30 项大大小小的配置，光是命名变数名称就会很麻烦：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 传统使用 ENV 就得写一长串超累:
BOARD_PAGINATION_PER_PAGE=5
BOARD_PAGINATION_MAX_PAGE=10
BOARD_REPLY_OMIT_CONDITION_N_RECENT_ONLY=5
BOARD_REPLY_OMIT_CONDITION_AVOID_ONLY_N_HIDDEN=2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;使用 YAML 就简单很多&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;board&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pagination&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;per_page&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
    &lt;span class="na"&gt;max_page&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
  &lt;span class="na"&gt;reply_omit_condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;n_recent_only&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
    &lt;span class="na"&gt;avoid_only_n_hidden&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是要怎样结合 YAML 的优势跟 ENV VAR 的优势呢？&lt;/p&gt;

&lt;p&gt;我的想法是：把 YAML 给 serialize 成一串文字，就能当 env var 传到远端了。&lt;/p&gt;

&lt;p&gt;本机开发跟远端部属的两个流程如下：&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2018/9fbe055f-80e7-4b6f-b29a-f5b9d37439e2.png!large" title="" alt=""&gt;&lt;/p&gt;
&lt;h2 id="安装"&gt;安装&lt;/h2&gt;
&lt;p&gt;用 Gemfile 安装以后：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'settei'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;在 rails 专案下执行以下 rake task 继续安装：&lt;/p&gt;

&lt;p&gt;$ rake settei:install:rails&lt;/p&gt;
&lt;h2 id="使用方法"&gt;使用方法&lt;/h2&gt;
&lt;p&gt;要是 &lt;code&gt;config/environments/default.yml&lt;/code&gt; 内容是这样的话：&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;the_answer_to_life_the_universe_and_everything&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;42&lt;/span&gt;
&lt;span class="na"&gt;google&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;foo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;就能这样取得配置&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;Setting&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:the_answer_to_life_the_universe_and_everything&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;Setting&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:google&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:api&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="部署"&gt;部署&lt;/h2&gt;
&lt;p&gt;要是你是使用 capistrano 或是 mina 的话，应该自动会有效。我塞了 code，所以 deploy 时，你的 production.yml 会直接变成 Env var 随着远端的 Rails server 启动。于是远端的 server 也就拿到了配置。&lt;/p&gt;

&lt;p&gt;要是你是使用 heroku 的话，使用 &lt;code&gt;rake settei:heroku:config:set app=[app_name]&lt;/code&gt; 来把 production.yml 上传到指定的 app 中。&lt;/p&gt;

&lt;p&gt;更详尽的使用方法请阅读 github，也欢迎指教～～&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Thu, 08 Mar 2018 10:45:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/35192</link>
      <guid>https://ruby-china.org/topics/35192</guid>
    </item>
    <item>
      <title>SMTP 已经设 587 但是错误却是写 localhost 25 正常吗？</title>
      <description>&lt;p&gt;新安装了 ubuntu 在 vultr 上，要寄信时都会出错：&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 25&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我很确定我上面跑的 production 环境是用 sendgrid 所要求的 port 587
从 production 的 rails console 看到的都是正确连到 sendgrid 的设定。&lt;/p&gt;

&lt;p&gt;后来发现自己没有装 postfix，装了以后这个问题就消失了。&lt;/p&gt;

&lt;p&gt;所以想来确认一下自己理解对不对：
ActionMailer 就算是设定好 SMTP port 了，
他还是会透过  localhost:25 跟像是 postfix 之类的 MTA 接触，之后才会用设定的 port 往 sendgrid 连？&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Sun, 11 Feb 2018 20:16:08 +0800</pubDate>
      <link>https://ruby-china.org/topics/35032</link>
      <guid>https://ruby-china.org/topics/35032</guid>
    </item>
    <item>
      <title>装 Ubuntu 时有什么 hardening 的 script 吗？</title>
      <description>&lt;p&gt;又到了需要装 Ubuntu 的季节了，距离上次装已经过了好几年，
想问说有什么自动化的 script 能把新装好的 ubuntu 给安全强化吗？
比如说 startup script 或是 ansible 之类的。&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Tue, 30 Jan 2018 13:56:33 +0800</pubDate>
      <link>https://ruby-china.org/topics/34970</link>
      <guid>https://ruby-china.org/topics/34970</guid>
    </item>
    <item>
      <title>Octopress 久未更新，大家有转到其他地方吗？</title>
      <description>&lt;p&gt;Octopress 的开发停止一年了，想问大家写 blog 网志的时候：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;还是使用 Octopress&lt;/li&gt;
&lt;li&gt;转到其他自架方式（能顺便推荐一下是用哪个 lib 吗）&lt;/li&gt;
&lt;li&gt;转到如 Medium 之类的服务&lt;/li&gt;
&lt;li&gt;部落格已经没落没人写了&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;感恩～&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Mon, 20 Nov 2017 14:44:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/34596</link>
      <guid>https://ruby-china.org/topics/34596</guid>
    </item>
    <item>
      <title>加强 model error 的 AdequateErrors 0.1 版公开</title>
      <description>&lt;p&gt;四月的时候曾经在这里提到改善 Rails Model Errors API 的想法：&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ruby-china.org/topics/32827" rel="nofollow" target="_blank"&gt;https://ruby-china.org/topics/32827&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;最近完成了初版，想邀请对 errors 有需求的版友来试用看看，搜集一下使用需求。感恩～&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/lulalala/adequate_errors" rel="nofollow" target="_blank"&gt;https://github.com/lulalala/adequate_errors&lt;/a&gt;&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Wed, 15 Nov 2017 10:54:51 +0800</pubDate>
      <link>https://ruby-china.org/topics/34577</link>
      <guid>https://ruby-china.org/topics/34577</guid>
    </item>
    <item>
      <title>想募集 ActiveModel::Errors 的業務需求，打造一个新的 Errors API</title>
      <description>&lt;p&gt;嗨各位，是这样的，我在工作需求上偶尔会碰到觉得 ActiveModel::Errors 不太好用的时候，
比如说 error message 有时不想要 prefix attribute name 之类的需求。
虽然最近有新的 error details api 能用，但是感觉只是叠床架屋。
所以想说我们是否能搜集大家平常碰过的 api 设计需求，
等到搜集一定程度以后，可以来设计符合这些需求的 errors API，然后来实作。&lt;/p&gt;

&lt;p&gt;我开了一个 repo，想说可以更新 wiki，或是发 issue 来搜集需求：&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/lulalala/rails_error_api_redesign/" rel="nofollow" target="_blank"&gt;https://github.com/lulalala/rails_error_api_redesign/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;要是你工作上正好碰到 errors api 的局限，欢迎来这里把你的 use case 加进来。&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Wed, 19 Apr 2017 17:33:33 +0800</pubDate>
      <link>https://ruby-china.org/topics/32827</link>
      <guid>https://ruby-china.org/topics/32827</guid>
    </item>
    <item>
      <title>搜尋出現日期怪怪的</title>
      <description>&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2017/4f900eb959991a76e83535fa90a3bfb9.png!large" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;不是大問題，只是搜 rust 時看到這篇文章，雖然是 2015 年的，但是顯示的日期卻是 2017。&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Tue, 14 Mar 2017 10:15:43 +0800</pubDate>
      <link>https://ruby-china.org/topics/32523</link>
      <guid>https://ruby-china.org/topics/32523</guid>
    </item>
    <item>
      <title>RubyKaigi 2015 感想</title>
      <description>&lt;p&gt;分享一下參加 Ruby Kaigi 2015 的感想，以及推薦一些我喜歡的演講：&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lulalala.logdown.com/posts/467723-rubykaigi-2015-thoughts" rel="nofollow" target="_blank"&gt;http://lulalala.logdown.com/posts/467723-rubykaigi-2015-thoughts&lt;/a&gt;&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Fri, 05 Feb 2016 13:09:11 +0800</pubDate>
      <link>https://ruby-china.org/topics/28957</link>
      <guid>https://ruby-china.org/topics/28957</guid>
    </item>
    <item>
      <title>搜寻时英文分词好像没照单字分</title>
      <description>&lt;p&gt;搜寻时，要是我搜 "ruby kaigi" 会有资料，但是用 "kaigi" 搜就没资料。也许是中文分词顾到了结果英文分词就没有？&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Thu, 04 Feb 2016 16:54:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/28952</link>
      <guid>https://ruby-china.org/topics/28952</guid>
    </item>
    <item>
      <title>如何关闭 Rails 4.2 在 MySQL 的毫秒精准度支援</title>
      <description>&lt;p&gt;Rails 4.2 起可以在 MySQL 中的 datetime 栏位支援毫秒了，不过实际上似乎需要做 migration，比如说我之前的栏位都是使用预设的 datetime，依照 &lt;a href="http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html" rel="nofollow" target="_blank"&gt;http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html&lt;/a&gt; 所说这样预设就是不能存毫秒。只有特别设定 datetime(6) 才能存。&lt;/p&gt;

&lt;p&gt;但是目前我不想要做 migration，可是预设精准度 0 会导致许多 spec 错误。Rails 没有聪明到说看到精准度 0 就把 select statement 自动也转成精准度 0，导致我许多 spec 在检查如“这一小时内产生的东西”都会出错，因为存进资料库的是 xxxx/xx/xx 00:00:00，但是读资料时却使用 xxxx/xx/xx 00:00:00.123123。&lt;/p&gt;

&lt;p&gt;有办法让 Rails 4.2 暂时不使用 fractional second 吗，也就是诸如 select 的指令也都统一把毫秒的部分拿掉。&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Tue, 03 Nov 2015 09:39:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/27929</link>
      <guid>https://ruby-china.org/topics/27929</guid>
    </item>
    <item>
      <title>做了一个检查 email domain 的 gem</title>
      <description>&lt;p&gt;嗨嗨来老王卖瓜了，有需求验证 email 地址的 domain 时请来试试看这个新的 gem，有提供 whitelist/caching/testing 功能节省网路验证。&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/lulalala/email_domain_validator" rel="nofollow" target="_blank"&gt;https://github.com/lulalala/email_domain_validator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;p.s. 用 Rails 的请套在 custom validator 里面 &lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Wed, 28 Jan 2015 08:10:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/23977</link>
      <guid>https://ruby-china.org/topics/23977</guid>
    </item>
    <item>
      <title>寻找能把 Rails 页面打包成静态 html 上传到远方的方案</title>
      <description>&lt;p&gt;我想要找 gem 或是 library，能够做到下面的事情：&lt;/p&gt;

&lt;p&gt;选择某个 controller action，指定 parameter 的组合后，每一页产生一个静态 html 档案。
等于是把 rails 当作静态网站产生器用。
然后也想要把更新好的网站 ftp 到远端的静态 server 去。&lt;/p&gt;

&lt;p&gt;不知道有什么类似功能的 gem 可以使用吗？&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Fri, 23 Jan 2015 17:15:28 +0800</pubDate>
      <link>https://ruby-china.org/topics/23910</link>
      <guid>https://ruby-china.org/topics/23910</guid>
    </item>
    <item>
      <title>QQ 的 Omniauth 认证有好多个</title>
      <description>&lt;p&gt;想要加入 QQ 认证，发现相关的 gem 有超多个。&lt;/p&gt;

&lt;p&gt;我只试了 qq-connect，但是失败，所以想试其他的。
（目前使用 &lt;a href="https://github.com/kaichen/omniauth-qq-connect" rel="nofollow" target="_blank"&gt;https://github.com/kaichen/omniauth-qq-connect&lt;/a&gt; ）
我基本上只想做到第三方认证以及取得 email，想问大家觉得哪个比较好？&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/tomorrownull/omniauth-qzone" rel="nofollow" target="_blank"&gt;https://github.com/tomorrownull/omniauth-qzone&lt;/a&gt; 是 QQ 空间的，没听过，不知道有什么不同。&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/cqpx/omniauth-tqq-oauth2/" rel="nofollow" target="_blank"&gt;https://github.com/cqpx/omniauth-tqq-oauth2/&lt;/a&gt; TQQ 不知道是什么，跟 qq-connect 的 api 是分开的。这是给 Oauth2 用的
&lt;a href="https://github.com/ballantyne/omniauth-tqq" rel="nofollow" target="_blank"&gt;https://github.com/ballantyne/omniauth-tqq&lt;/a&gt; 似乎是比较旧的版本？&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/skinnyworm/omniauth-wechat-oauth2" rel="nofollow" target="_blank"&gt;https://github.com/skinnyworm/omniauth-wechat-oauth2&lt;/a&gt; 给 WeChat 用的，估计也是分开的。&lt;/p&gt;

&lt;p&gt;当然还有整合 tqq 跟 qq-connect 的：
&lt;a href="https://github.com/beenhero/omniauth-qq" rel="nofollow" target="_blank"&gt;https://github.com/beenhero/omniauth-qq&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;感觉就像是过江之鲫一样的多选择呀～&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Thu, 23 Oct 2014 10:02:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/22207</link>
      <guid>https://ruby-china.org/topics/22207</guid>
    </item>
    <item>
      <title>form_relayer - 製作確認頁用</title>
      <description>&lt;p&gt;發佈第一版：&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/GoodLife/form_relayer" rel="nofollow" target="_blank"&gt;https://github.com/GoodLife/form_relayer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;嗨各位，要是你在 POST 时，想要中间插一个确认页面或是长长法律条文页，请来试试看这个 gem 吧。他让你能把 POST param 再输出成 hidden input 让你能再 POST 出去。&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Wed, 13 Aug 2014 00:37:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/20994</link>
      <guid>https://ruby-china.org/topics/20994</guid>
    </item>
    <item>
      <title>跳过 less 或是优先选 sass？</title>
      <description>&lt;p&gt;用了一个 bower 包，里面提供 less 跟 sass 两种选择的样式表。&lt;/p&gt;

&lt;p&gt;我在 asset precompile 时发现他会抱怨没有 less。&lt;/p&gt;

&lt;p&gt;因为我本身只用 sass，不想特别安装 less-rails，有办法让 sprocket 主动选择 scss 或是让他略过 less 吗？&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Thu, 20 Mar 2014 15:42:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/18040</link>
      <guid>https://ruby-china.org/topics/18040</guid>
    </item>
    <item>
      <title>cells-collection：用來呼叫同個 cell 多次的 gem</title>
      <description>&lt;p&gt;有用 cells 的各位，要是你是用远端 memcached server，或是一次需要显示同种 cell 五十多次，请来用用看这个 &lt;a href="https://github.com/GoodLife/cells-collection" rel="nofollow" target="_blank"&gt;https://github.com/GoodLife/cells-collection&lt;/a&gt; gem。理论上能减少一些 render 时间。&lt;/p&gt;

&lt;p&gt;他的原理就是，如果你要一次显示三十篇留言，每篇都是一个 cell，那么与其呼叫 render_cell 三十次：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;% @comments.each do |c| %&amp;gt;
  &amp;lt;%= render_cell :comment, :single, c %&amp;gt;
&amp;lt;% end %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;干脆只呼叫一次好了&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;%= render_cell_collection :comment, :single, @comments %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这样子的好处是，使用 caching 时，我们可以下一个 memcached 指令就捞 30 笔暂存，而不需要下三十次指令。&lt;/p&gt;

&lt;p&gt;本机用效果差异不大，不过 cell 数量一多，或是 memcached 是在远端时，应该可以省一些时间。&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Wed, 06 Nov 2013 09:38:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/15332</link>
      <guid>https://ruby-china.org/topics/15332</guid>
    </item>
    <item>
      <title>一个让 JSON 产生加快的 patch</title>
      <description>&lt;p&gt;嗨各位，&lt;a href="https://github.com/GoodLife/rails-patch-json-encode" rel="nofollow" target="_blank"&gt;https://github.com/GoodLife/rails-patch-json-encode&lt;/a&gt; 是一个 Rails 的 monkey patch gem，能让 json 产生速度加快。&lt;/p&gt;

&lt;p&gt;能加速的理由主要是两点。首先 Rails 虽然号称有使用 multi_json，理论上能套用 oj gem 加快 json 速度，可是其实 Rails 只有解析 json 时才会用到 multi_json，生成时是不会用到的。再来，Rails 因为某些原因（详见 readme）把生成的呼叫定死在 ActionSupport 的版本上，这是一个纯 Ruby 的实作，所以就是会慢。&lt;/p&gt;

&lt;p&gt;本 gem 就是把产生 json 的呼叫绑订到 multi_json 上，所以产生 json 就能靠那些 c library 完成。我搭配 oj 实际测试，小 json 档案的产生时间减少 25%，而像是 readme 中的大 json 范例更能减少 90% 的时间。&lt;/p&gt;

&lt;p&gt;不过因为还不能确认是不是有后遗症，所以想来这里问问看大家有没有什么非 production 的 project 能够拿来测试一下这个 gem。谢谢啰～&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Tue, 24 Sep 2013 22:43:24 +0800</pubDate>
      <link>https://ruby-china.org/topics/14360</link>
      <guid>https://ruby-china.org/topics/14360</guid>
    </item>
    <item>
      <title>Rails 存设定的私人偏方</title>
      <description>&lt;p&gt;老王卖瓜来自推一下我自己使用 Settingslogic 的心得：
&lt;a href="http://lulalala.logdown.com/posts/91804-rails-config-settings" rel="nofollow" target="_blank"&gt;http://lulalala.logdown.com/posts/91804-rails-config-settings&lt;/a&gt;&lt;/p&gt;</description>
      <author>lulalala</author>
      <pubDate>Sun, 25 Aug 2013 19:24:33 +0800</pubDate>
      <link>https://ruby-china.org/topics/13604</link>
      <guid>https://ruby-china.org/topics/13604</guid>
    </item>
  </channel>
</rss>
