<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>villins (villins)</title>
    <link>https://ruby-china.org/villins</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>请教个 Sinatra ActiveRecord 时间时区问题</title>
      <description>&lt;p&gt;在 &lt;code&gt;sinatra&lt;/code&gt; 设置了 &lt;code&gt;Time&lt;/code&gt; 的时区如下：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Time.zone = "Beijing"
ActiveRecord::Base.default_timezone = :local
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;然后获取 model 里面的时间字段&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Show.last.show_time
2016-06-14 15:20:00 +0800

Show.last.show_time.utc
2016-06-14 07:20:00 UTC
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这里用 active_record 获取展示的时间值是错误的
设置了北京时区，获取值不加 8 小时却设置成 CST，取 utc 值却在已是 utc 时间再减 8 小时&lt;/p&gt;

&lt;p&gt;从 rails 获取出来的正确值如下&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Show.last.show_time
Tue, 14 Jun 2016 23:20:00 CST +08:00

Show.last.show_time.utc

2016-06-14 15:20:00 UTC
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;创建时间居然也没有转换成 utc 时间入库，wtf
一样是 &lt;code&gt;ActiveRecord::Base&lt;/code&gt; 的子类
在 sinatra 的 datetime 字段的 class 居然是 Time，而在 rails 的是 ActiveSupport::TimeWithZone &amp;lt; Object&lt;/p&gt;</description>
      <author>villins</author>
      <pubDate>Tue, 14 Jun 2016 17:45:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/30281</link>
      <guid>https://ruby-china.org/topics/30281</guid>
    </item>
    <item>
      <title>java 加密获取裸公钥转换成 ruby code</title>
      <description>&lt;p&gt;谷歌许久，查文档，想破头皮，依旧无解，求有没有什么建议的方式实现这下面代码的转换？&lt;/p&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;RsaKeyGenerateDemo&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;KeyPairGenerator&lt;/span&gt; &lt;span class="n"&gt;keyPairGen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;KeyPairGenerator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getInstance&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"RSA"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;keyPairGen&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initialize&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RSAKeyGenParameterSpec&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1408&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BigInteger&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"3"&lt;/span&gt;&lt;span class="o"&gt;)),&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SecureRandom&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
  &lt;span class="nc"&gt;KeyPair&lt;/span&gt; &lt;span class="n"&gt;keyPair&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;keyPairGen&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;generateKeyPair&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="nc"&gt;PublicKey&lt;/span&gt; &lt;span class="n"&gt;publicKey&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;keyp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPublic&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;publicKey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getModulus&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;toString&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;toUpperCase&lt;/span&gt;&lt;span class="o"&gt;();)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;更新：貌似这个 &lt;a href="https://github.com/bendiken/rsa" rel="nofollow" target="_blank" title=""&gt;rsa&lt;/a&gt; gem 有点相似&lt;/p&gt;</description>
      <author>villins</author>
      <pubDate>Tue, 12 Jan 2016 17:37:21 +0800</pubDate>
      <link>https://ruby-china.org/topics/28706</link>
      <guid>https://ruby-china.org/topics/28706</guid>
    </item>
    <item>
      <title>Object#try 对潜在的 Rails 中的 nil 调用方法</title>
      <description>&lt;h3 id="对潜在的 Rails 中的 nil 调用方法"&gt;对潜在的 Rails 中的 nil 调用方法&lt;/h3&gt;
&lt;p&gt;在 Rails 中，我们平常可以使用很多非常便利的方法，其中有一个我认为有点 cool 的方法 —— &lt;a href="http://apidock.com/rails/Object/try" rel="nofollow" target="_blank" title=""&gt;Object#try&lt;/a&gt; 
它有什么作用昵，它可以让我们调用一个对象不用担心这个对象是否为 nil，因此抛出异常。
如何使用它，如下&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="s2"&gt;"HELLO WORLD"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;try&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:downcase&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"hello world"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;看起来跟 &lt;a href="http://apidock.com/ruby/Object/send" rel="nofollow" target="_blank" title=""&gt;Object#send&lt;/a&gt; 差不多，都是传递 symbol，args 和 block，但是差别就是上面所说，nil 使用 send 去调用不属于 nil 的方法，还是会引起异常。&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="kp"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:downcase&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;NoMethodError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;undefined&lt;/span&gt; &lt;span class="nb"&gt;method&lt;/span&gt; &lt;span class="sb"&gt;`downcase' for nil:NilClass
nil.try(:downcase)
=&amp;gt; nil
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;拿我们项目中的代码来举例&lt;/p&gt;
&lt;h5 id="before 没有使用 try"&gt;before 没有使用 try&lt;/h5&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# helper method&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ymdhm_strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"%Y-%m-%d %H:%M"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;present?&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="c1"&gt;# erb &lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;上映&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;nbsp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= ymd_strftime(@film.show_date) %&amp;gt;&amp;lt;/p&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="after 使用 try"&gt;after 使用 try&lt;/h4&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# 可以直接在页面使用&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;上映&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;nbsp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= @film.show_date.try(strftime, "%Y-%m-%d %H:%M") %&amp;gt;&amp;lt;/p&amp;gt;
＃ 可以重构 helper method
def ymdhm_strftime(time)
  time.try(strftime, "%Y-%m-%d %H:%M")
end
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;还有 try 可以链式调用&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="s2"&gt;"HELLO WORLD"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;try&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:downcase&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;try&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:capitalize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"Hello world"&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="c1"&gt;# object_try.rb&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'benchmark/ips'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'active_support/core_ext/object/try'&lt;/span&gt;
&lt;span class="no"&gt;Benchmark&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ips&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;x&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;report&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"try method"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"hello"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;try&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:upcase&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;report&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"call method"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"hello"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upcase&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compare!&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ruby object_try.rb
Calculating &lt;span class="nt"&gt;-------------------------------------&lt;/span&gt;
          try method    62.882k i/100ms
         call method    74.916k i/100ms
&lt;span class="nt"&gt;-------------------------------------------------&lt;/span&gt;
          try method      1.861M &lt;span class="o"&gt;(&lt;/span&gt;± 8.7%&lt;span class="o"&gt;)&lt;/span&gt; i/s -      9.244M
         call method      2.737M &lt;span class="o"&gt;(&lt;/span&gt;± 8.2%&lt;span class="o"&gt;)&lt;/span&gt; i/s -     13.635M
Comparison:
         call method:  2736550.4 i/s
          try method:  1861489.0 i/s - 1.47x slower
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>villins</author>
      <pubDate>Sat, 08 Aug 2015 12:23:46 +0800</pubDate>
      <link>https://ruby-china.org/topics/26827</link>
      <guid>https://ruby-china.org/topics/26827</guid>
    </item>
    <item>
      <title>rails tutorial 中 ajax 问题</title>
      <description>&lt;p&gt;在按照书中代码编写 follow 和 unfollow 按钮时，添加上 ajax 功能后&lt;/p&gt;

&lt;p&gt;点击之后就会出现错误&lt;/p&gt;

&lt;p&gt;下面为点 unfollow 点击出现的错误信息&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Started DELETE "/relationships/1" for 127.0.0.1 at 2012-10-28 20:53:33 +0800
Processing by RelationshipsController#destroy as JS
  Parameters: {"utf8"=&amp;gt;"✓", "authenticity_token"=&amp;gt;"A5HEZNjXLdmCzAO5BXmPXb3X2VkHs8rDpqrw/zErq0k=", "commit"=&amp;gt;"Unfollow", "id"=&amp;gt;"1"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
  Rendered users/_unfollow.html.erb (2.2ms)
  Rendered relationships/destroy.js.erb (2.9ms)
Completed 500 Internal Server Error in 6ms

ActionView::Template::Error (Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id):
    1: &amp;lt;%= form_for(current_user.relationships.find_by_followed_id(@user.id),
    2:              :html =&amp;gt; { :method =&amp;gt; :delete },
    3:              :remote =&amp;gt; true) do |f| %&amp;gt;
    4:   &amp;lt;div class="actions"&amp;gt;&amp;lt;%= f.submit "Unfollow" %&amp;gt;&amp;lt;/div&amp;gt;
  app/views/users/_unfollow.html.erb:1:in `_app_views_users__unfollow_html_erb__1917503669697459990_70063164482580'
  app/views/relationships/destroy.js.erb:1:in `_app_views_relationships_destroy_js_erb___120623583448683911_70063171541040'

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;_destroy.js.erb&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$("follow_form").update("&amp;lt;%= escape_javascript(render('users/unfollow')) %&amp;gt;")
$("followers").update('&amp;lt;%= "#{@user.followers.count} followers" %&amp;gt;')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;查找了好久，找不出解决方法&lt;/p&gt;

&lt;p&gt;还有求点 rails 中用 ajax 的资料&lt;/p&gt;</description>
      <author>villins</author>
      <pubDate>Sun, 28 Oct 2012 21:15:10 +0800</pubDate>
      <link>https://ruby-china.org/topics/6372</link>
      <guid>https://ruby-china.org/topics/6372</guid>
    </item>
    <item>
      <title>rails tutorial 里面的问题</title>
      <description>&lt;p&gt;如下面这个代码&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;before_save :encrypt_password

def has_password?(submitted_password)
  encrypted_password == encrypt(submitted_password)
end
private
  def encrypt_password
    self.salt = make_salt if new_record?
  self.encrypted_password = encrypt(password)
  end
  def encrypt(string)
    secure_hash("#{salt}--#{string}")
  end
  def make_salt
    secure_hash("#{Time.now.utc}--#{password}")
  end
  def secure_hash(string)
    Digest::SHA2.hexdigest(string)
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;中的&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def has_password?(submitted_password)
  encrypted_password == encrypt(submitted_password)
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;的 encrypted_password 是使用的 encrypted_password 方法还是 model 的变量的呢？&lt;/p&gt;

&lt;p&gt;rails tutorails 中的这段代码&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rails console --sandbox
&amp;gt;&amp;gt; User.create(:name =&amp;gt; "Michael Hartl", :email =&amp;gt; "mhartl@example.com",
:password =&amp;gt; "foobar", :password_confirmation =&amp;gt; "foobar")
&amp;gt;&amp;gt; user = User.find_by_email("mhartl@example.com")
&amp;gt;&amp;gt; user.has_password?("foobar")
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;返回是 true
而我测试的是 false
检查出来的原因，在调用 has_password？中的 self.encrypted_password = encrypt(password) 的 password 是空值&lt;/p&gt;

&lt;p&gt;是不是 rails tutorails 书上错误，还是我理解代码写错了，忘指点迷津下&lt;/p&gt;</description>
      <author>villins</author>
      <pubDate>Sun, 14 Oct 2012 13:10:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/6048</link>
      <guid>https://ruby-china.org/topics/6048</guid>
    </item>
    <item>
      <title>/config/environment.rb:6:in `&lt;top (required)&gt;': undefined local variable or method `config' for main:Object (NameError)</title>
      <description>&lt;p&gt;我在 environment.rb 中添加了一句 config.gem 'tiny_mce'，具体如下：&lt;/p&gt;
&lt;h2 id="Load the rails application"&gt;Load the rails application&lt;/h2&gt;
&lt;p&gt;require File.expand_path('../application', &lt;strong&gt;FILE&lt;/strong&gt;)&lt;/p&gt;
&lt;h2 id="Initialize the rails application"&gt;Initialize the rails application&lt;/h2&gt;
&lt;p&gt;MyBlog::Application.initialize!
config.gem 'tiny_mce'&lt;/p&gt;

&lt;p&gt;一启动服务就出现如下错误：&lt;/p&gt;

&lt;p&gt;/home/villins/MyBlog/config/environment.rb:6:in &lt;code&gt;&amp;lt;top (required)&amp;gt;': undefined local variable or method&lt;/code&gt;config' for main:Object (NameError)
    from /home/villins/MyBlog/config.ru:4:in &lt;code&gt;require'
    from /home/villins/MyBlog/config.ru:4:in&lt;/code&gt;block in &lt;/p&gt;'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in &lt;code&gt;instance_eval'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in&lt;/code&gt;initialize'
    from /home/villins/MyBlog/config.ru:1:in &lt;code&gt;new'
    from /home/villins/MyBlog/config.ru:1:in&lt;/code&gt;'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in &lt;code&gt;eval'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in&lt;/code&gt;parse_file'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:200:in &lt;code&gt;app'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in&lt;/code&gt;app'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:301:in &lt;code&gt;wrapped_app'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:252:in&lt;/code&gt;start'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in &lt;code&gt;start'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:55:in&lt;/code&gt;block in '
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:50:in &lt;code&gt;tap'
    from /home/villins/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:50:in&lt;/code&gt;'
    from script/rails:6:in &lt;code&gt;require'
    from script/rails:6:in&lt;/code&gt;'&lt;p&gt;&lt;/p&gt;

&lt;p&gt;请问有什么解决方法吗？  &lt;/p&gt;</description>
      <author>villins</author>
      <pubDate>Sat, 26 May 2012 10:53:11 +0800</pubDate>
      <link>https://ruby-china.org/topics/3497</link>
      <guid>https://ruby-china.org/topics/3497</guid>
    </item>
  </channel>
</rss>
