<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>phaibin (文祥)</title>
    <link>https://ruby-china.org/phaibin</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Routes 里面 API 加版本号的问题</title>
      <description>&lt;p&gt;用 Rails 做接口，给接口加版本会这么做：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="ss"&gt;:api&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="ss"&gt;:v1&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;resources&lt;/span&gt; &lt;span class="ss"&gt;:users&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;对应的文件是 api/v1/users_controller.rb，类是 Api::V1::UsersController。&lt;/p&gt;

&lt;p&gt;如果是小版本怎么办呢：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="ss"&gt;:api&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="ss"&gt;:'v1.1'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;resources&lt;/span&gt; &lt;span class="ss"&gt;:users&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这样要怎么设置对应的文件和 Controller 名？&lt;/p&gt;</description>
      <author>phaibin</author>
      <pubDate>Fri, 26 Dec 2014 13:26:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/23416</link>
      <guid>https://ruby-china.org/topics/23416</guid>
    </item>
    <item>
      <title>Chef 的错误</title>
      <description>&lt;p&gt;这两天在看《Rails 程序部署之道》这本书，在“5 分钟架设服务器”这一节安装步骤来做，在 cook 这一步：&lt;/p&gt;

&lt;p&gt;bundle exec knife solo cook root@x.x.x.x&lt;/p&gt;

&lt;p&gt;运行到这里：&lt;/p&gt;

&lt;p&gt;Generating solo config...
    Running Chef...
    ERROR: Network Error: Connection refused - connect(2) for "x.x.x.x" port 22
    Check your knife configuration and network settings&lt;/p&gt;

&lt;p&gt;就出错了。然后用 root 来 ssh 登录也不行了，要过几分钟才可以。&lt;/p&gt;

&lt;p&gt;这到底是什么情况？&lt;/p&gt;</description>
      <author>phaibin</author>
      <pubDate>Fri, 27 Jun 2014 17:20:14 +0800</pubDate>
      <link>https://ruby-china.org/topics/20202</link>
      <guid>https://ruby-china.org/topics/20202</guid>
    </item>
    <item>
      <title>在 action 中如何多次返回结果？</title>
      <description>&lt;p&gt;我想这么用：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;post&lt;/span&gt; &lt;span class="s1"&gt;'/upload'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
   &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;times&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;i&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;
        &lt;span class="nb"&gt;sleep&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;就是处理一段时间返回一个结果，不知道怎么写。&lt;/p&gt;</description>
      <author>phaibin</author>
      <pubDate>Mon, 02 Sep 2013 14:26:39 +0800</pubDate>
      <link>https://ruby-china.org/topics/13823</link>
      <guid>https://ruby-china.org/topics/13823</guid>
    </item>
    <item>
      <title>在 redirect 的时候可以修改 request 的 header 么？</title>
      <description>&lt;p&gt;我试过在发 redirect 之前，修改 request 的 header，但是没有成功。不知道是方法不对，还是根本做不到？&lt;/p&gt;</description>
      <author>phaibin</author>
      <pubDate>Fri, 30 Aug 2013 11:35:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/13741</link>
      <guid>https://ruby-china.org/topics/13741</guid>
    </item>
    <item>
      <title>sublime text 里面怎么实现 action 和 view 之间跳转的这种功能</title>
      <description>&lt;p&gt;在 Textmate 的 rails bundle 里面有这种功能，就是在 rails 的几种结构之间跳转。sublime text 只有文件的跳转。最重要的是 Textmate 在跳转时发现没有该文件会提示你新建文件，这个真的很方便。不知道 sublime text 有什么插件能实现这些功能？&lt;/p&gt;</description>
      <author>phaibin</author>
      <pubDate>Sat, 02 Mar 2013 11:43:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/9065</link>
      <guid>https://ruby-china.org/topics/9065</guid>
    </item>
  </channel>
</rss>
