<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>shallow__pace (赵书剑)</title>
    <link>https://ruby-china.org/shallow__pace</link>
    <description>唯爱与美食不能辜负！</description>
    <language>en-us</language>
    <item>
      <title>七牛云存储</title>
      <description>&lt;p&gt;七牛云存储是用于托管网站静态文件，提供静态文件 CDN 加速，在线提供图像视频处理 API 的服务。
使用七牛云存储可以将 blog 中的静态图片保存在七牛的服务器上，通过外链的方式在 blog 引用，同时可以通过 RESTFUL 的方式通过 HTTP API 控制图片的大小，质量，格式等。&lt;/p&gt;

&lt;p&gt;也可以将网站的 css、js、视频的静态文件托管在七牛的服务中，节省服务器的硬盘空间。配合 github 搭建 blog 会更加有效。&lt;/p&gt;

&lt;p&gt;推广链接在此：portal.qiniu.com/signup?code=16ewzf28owmkx&lt;/p&gt;

&lt;p&gt;大家支持支持，好吧，我承认我是为了 Jawbone UP 来的。。&lt;/p&gt;</description>
      <author>shallow__pace</author>
      <pubDate>Tue, 13 Aug 2013 10:30:24 +0800</pubDate>
      <link>https://ruby-china.org/topics/13287</link>
      <guid>https://ruby-china.org/topics/13287</guid>
    </item>
    <item>
      <title>怒了，这回 bcrypt-ruby 又出问题了</title>
      <description>&lt;p&gt;&lt;code&gt;gem 'bcrypt-ruby'&lt;/code&gt;
报错：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/sergio/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb 
creating Makefile

make
compiling wrapper.c
In file included from wrapper.c:27:0:
/home/sergio/.rvm/rubies/ruby-2.0.0-p195/include/ruby-2.0.0/ruby/backward/util.h:2:2: 警告： #warning use "ruby/util.h" instead of bare "util.h" [-Wcpp]
wrapper.c: 在函数‘crypt_gensalt_rn’中:
wrapper.c:204:3: 错误： ‘EINVAL’未声明(在此函数内第一次使用)
wrapper.c:204:3: 附注： 每个未声明的标识符在其出现的函数内只报告一次
make: *** [wrapper.o] 错误 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这都是个啥啊。。。&lt;/p&gt;</description>
      <author>shallow__pace</author>
      <pubDate>Fri, 28 Jun 2013 16:19:53 +0800</pubDate>
      <link>https://ruby-china.org/topics/12073</link>
      <guid>https://ruby-china.org/topics/12073</guid>
    </item>
    <item>
      <title>rails spork 的坑</title>
      <description>&lt;p&gt;安装&lt;code&gt;rails tutorial&lt;/code&gt;的设置安装的&lt;code&gt;spork&lt;/code&gt;，最后启动&lt;code&gt;spork&lt;/code&gt;的时候死活启动不起来
报错如下：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Using RSpec
Preloading Rails environment
uninitialized constant ActiveModel::Observing (NameError)
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork/app_framework/rails.rb:56:in `preload_rails'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork/app_framework/rails.rb:7:in `preload'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork/test_framework.rb:134:in `block in preload'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork.rb:62:in `exec_prefork'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork/test_framework.rb:120:in `preload'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:25:in `preload'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork/runner.rb:74:in `run'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/lib/spork/runner.rb:10:in `run'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/gems/spork-0.9.2/bin/spork:10:in `&amp;lt;top (required)&amp;gt;'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/bin/spork:23:in `load'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/bin/spork:23:in `&amp;lt;main&amp;gt;'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
/home/sergio/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `&amp;lt;main&amp;gt;'

real    0m1.925s
user    0m1.776s
sys 0m0.128s
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;看了下&lt;code&gt;github&lt;/code&gt;，在&lt;code&gt;gem&lt;/code&gt;中使用&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem 'spork-rails', github: 'railstutorial/spork-rails'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;解决了。。又是坑&lt;/p&gt;</description>
      <author>shallow__pace</author>
      <pubDate>Thu, 27 Jun 2013 12:34:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/12034</link>
      <guid>https://ruby-china.org/topics/12034</guid>
    </item>
    <item>
      <title>关于 rails4 的 app/models</title>
      <description>&lt;p&gt;用脚手架生成了一下代码&lt;code&gt;rails generate scaffold User name:string email:string&lt;/code&gt;
然后数据库迁移&lt;code&gt;bundle exec rake db:migrate&lt;/code&gt;
查看 rails 项目中的&lt;code&gt;app/models/user.rb&lt;/code&gt;，内部代码如下：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User &amp;lt; ActiveRecord::Base
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是&lt;code&gt;railstutorial&lt;/code&gt;上 3.0 版本的代码应该如下：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User &amp;lt; ActiveRecord::Base
  attr_accessible :email, :name
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;本人环境是&lt;code&gt;rails4.0&lt;/code&gt;，请问 4.0 中 attr_accessible 部分是移到哪去了，或者说是做了什么改变？&lt;/p&gt;</description>
      <author>shallow__pace</author>
      <pubDate>Mon, 24 Jun 2013 19:34:23 +0800</pubDate>
      <link>https://ruby-china.org/topics/11960</link>
      <guid>https://ruby-china.org/topics/11960</guid>
    </item>
    <item>
      <title>rails 搭建环境的问题</title>
      <description>&lt;p&gt;本人环境：linuxmint 15   &lt;/p&gt;

&lt;p&gt;先安装&lt;code&gt;rvm&lt;/code&gt;，然后使用&lt;code&gt;rvm list&lt;/code&gt;，发现已经安装好 ruby2.0&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rvm rubies

=* ruby-2.0.0-p195 [ x86_64 ]

# =&amp;gt; - current
# =* - current &amp;amp;&amp;amp; default
#  * - default
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;同样&lt;code&gt;gem&lt;/code&gt;也安装好了，但是有好几个，都是 2.0.3 版本的&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem                         
gem-ruby-2.0.0-p195         
gem-ruby-2.0.0-p195@global  
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;然后&lt;code&gt;gem install rails&lt;/code&gt;，一切正常，&lt;code&gt;gem list&lt;/code&gt;中也有&lt;code&gt;rails&lt;/code&gt;&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;actionmailer (3.2.13)
actionpack (3.2.13)
activemodel (3.2.13)
activerecord (3.2.13)
activeresource (3.2.13)
activesupport (3.2.13)
arel (3.0.2)
bigdecimal (1.2.0)
builder (3.0.4)
bundler (1.3.5)
erubis (2.7.0)
hike (1.2.2)
i18n (0.6.1)
io-console (0.4.2)
journey (1.0.4)
json (1.7.7)
mail (2.5.4)
mime-types (1.23)
minitest (4.3.2)
multi_json (1.7.4)
polyglot (0.3.3)
psych (2.0.0)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)                         #############   我在这里噢 ！##############
railties (3.2.13)
rake (10.0.4, 0.9.6)
rdoc (4.0.0, 3.12.2)
rubygems-bundler (1.1.1)
rvm (1.11.3.8)
sprockets (2.2.2)
test-unit (2.0.0.0)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.12)
tzinfo (0.3.37)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是使用&lt;code&gt;rails new xxx&lt;/code&gt;的时候就发现系统命令行还没有&lt;code&gt;rails&lt;/code&gt;&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;程序 'rails' 已包含在下列软件包中：
 * rails
 * ruby-railties-3.2
请尝试：sudo apt-get install &amp;lt;选定的软件包&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;各位大大看看这个问题是怎么一回事呢？&lt;/p&gt;</description>
      <author>shallow__pace</author>
      <pubDate>Sun, 02 Jun 2013 15:39:08 +0800</pubDate>
      <link>https://ruby-china.org/topics/11422</link>
      <guid>https://ruby-china.org/topics/11422</guid>
    </item>
    <item>
      <title>关于 retry 和 redo 的问题请教</title>
      <description>&lt;p&gt;大家好，我的环境是 linux mint 15 &amp;amp; ruby 1.9.3&lt;/p&gt;

&lt;p&gt;然后我编辑了下面这一段程序：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;repeat&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;yield&lt;/span&gt;
  &lt;span class="k"&gt;retry&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;condition&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;repeat&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;repeat&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是编译器报错了：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/home/sergio/Dropbox/codeworkspace/ruby_practice/custom_iterator.rb:3: Invalid retry
/home/sergio/Dropbox/codeworkspace/ruby_practice/custom_iterator.rb: compile error (SyntaxError)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我试了下将&lt;code&gt;retry&lt;/code&gt;替换成&lt;code&gt;redo&lt;/code&gt;，但是还是报错 Invalid redo。。。&lt;/p&gt;

&lt;p&gt;各位大大们知道是怎么一回事吗？&lt;/p&gt;</description>
      <author>shallow__pace</author>
      <pubDate>Sun, 02 Jun 2013 07:45:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/11415</link>
      <guid>https://ruby-china.org/topics/11415</guid>
    </item>
  </channel>
</rss>
