<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>adventurelw (冒险王)</title>
    <link>https://ruby-china.org/adventurelw</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>Bootstrap control-group 对齐问题</title>
      <description>&lt;p&gt;.control-group 自己会对齐表单和标签
但我不知道怎么回事，代码和本站源代码一样，都是 simple_form 里面
用 f.input
其余什么也不加的话，本站表单每一对 label 和 input 显示在一行，我的显示在两行。。。。。。看网页源码没有区别。同系统同浏览器。
我把 label 的 float 设置为 left 之后，就变成一行了，但完全没有对齐效果了。。。。。
这是怎么回事呢？&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Thu, 13 Jun 2013 21:16:27 +0800</pubDate>
      <link>https://ruby-china.org/topics/11703</link>
      <guid>https://ruby-china.org/topics/11703</guid>
    </item>
    <item>
      <title>textarea 大小设定</title>
      <description>&lt;p&gt;f.text_area
使用 rows, cols, size 属性都没问题。
但
&lt;code&gt;style: 'width: 200px; height: 150px;'&lt;/code&gt;
则 width 有效，height 无效&lt;/p&gt;

&lt;p&gt;在 css 文件中
设定&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;textarea {
  height: 150px;
  width: 200px;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;完全无效，只会有默认的 rows=30 生效。。。。。。
求教！！！！！&lt;/p&gt;

&lt;p&gt;chrome 浏览器。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Sun, 19 May 2013 11:41:23 +0800</pubDate>
      <link>https://ruby-china.org/topics/11090</link>
      <guid>https://ruby-china.org/topics/11090</guid>
    </item>
    <item>
      <title>helper 方法在 controller 和 view 中表现不一样</title>
      <description>&lt;p&gt;在 SessionsHelper 中定义了
current_user 和 current_user=(user) 方法
include 到 controller 中，表现正常
但在 view 中 current_user 就变成 nil 了。。。。。。
由于这是登陆认证方法，所以在本地保存了 cookies 信息的
&lt;code&gt;def current_user
  @current_user ||= User.find_by_xxx
end&lt;/code&gt;
方式来获取 controller action 中已经生成的 current_user，为啥在 view 中就不能用了呢？
百思不得其解，请教。。。。。。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Wed, 08 May 2013 01:28:57 +0800</pubDate>
      <link>https://ruby-china.org/topics/10804</link>
      <guid>https://ruby-china.org/topics/10804</guid>
    </item>
    <item>
      <title>使用 capybara features 现在是不是只能手动？</title>
      <description>&lt;p&gt;好像没有相应的 rails g 或者 rspec 命令可以生成到 features 下的文件。
请教。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Thu, 18 Apr 2013 23:16:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/10323</link>
      <guid>https://ruby-china.org/topics/10323</guid>
    </item>
    <item>
      <title>git 提交多个仓库</title>
      <description>&lt;p&gt;先提交到 github:
git remote add origin git@github.com:xxxx/yyy.git
git push -u origin master
没问题&lt;/p&gt;

&lt;p&gt;再提交到 gitcafe:
git remote add origin2 git@gitcafe.com:xxxx/yyy.git
git push -u origin2 master
以下信息：
Warning: Permanently added the RSA host key for IP address '117.79.146.98' to the list of known hosts.
Project identified as xxxx@yyy doesn't exist.
fatal: The remote end hung up unexpectedly&lt;/p&gt;

&lt;p&gt;但实际上 xxxx/yyy 存在，将.git/config 里面的
[remote "origin2"] 删除，修改 [remote "origin"] 中 url github 为 gitcafe，然后就可以顺利提交，但每次都改一下稍微有点麻烦。
请教怎么弄可以直接一点？比如我
git push -u origin master 到 github
git push -u origin2 master 到 gitcafe
十分感谢。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Mon, 15 Apr 2013 23:31:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/10230</link>
      <guid>https://ruby-china.org/topics/10230</guid>
    </item>
    <item>
      <title>bundler1.3.0 怎么装安装？</title>
      <description>&lt;p&gt;安装 2.0.0 和 RubyGems 2.0.0 都没问题
rails 也没问题，但 bundler 始终停在 1.2.4 这个版本，gem update bundler 和 gem install bundler 都无法升级到 1.3.0，rubygems.org 已经更新到 1.3.0 了。。。。。。不知道应该怎么弄？bundle install 无法执行，说 ruby2.0.0 不兼容 bundler1.2.4..&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Mon, 25 Feb 2013 20:16:39 +0800</pubDate>
      <link>https://ruby-china.org/topics/8920</link>
      <guid>https://ruby-china.org/topics/8920</guid>
    </item>
    <item>
      <title>重写 Gem 的某些 helper 方法问题</title>
      <description>&lt;p&gt;rails_admin gem 的 app/helper/rails_admin/application_helper.rb 里 edit_user_link 方法需要重写一下，但在自己的 app/helper/rails_admin/application_helper.rb 没有办法只写这一个，全都要拷过来才行。
请教有没有办法只写 edit_user_link 这一个方法的？因为其余不需要改变。
万分感谢。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Wed, 30 Jan 2013 22:13:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/8500</link>
      <guid>https://ruby-china.org/topics/8500</guid>
    </item>
    <item>
      <title>求问 factory_girl 错误</title>
      <description>&lt;p&gt;rails g model xxxx xxx:ss xxx:yy 时，invoke factory_girl 这一步发生错误：
.rvm/gems/ruby-1.9.3-p374@rails3.2.11/gems/factory_girl_rails-4.2.0/lib/generators/factory_girl/model/model_generator.rb:21:in `generators': uninitialized constant FactoryGirl::Railtie (NameError)&lt;/p&gt;

&lt;p&gt;spec_helper 里面有&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config.include FactoryGirl::Syntax::Methods
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;config/application.rb里有&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config.generators do |g|
   g.fixture_replacement :factory_girl, :dir =&amp;gt; 'spec/factories'
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;对 factory_girl 的配置应该就这两个地方了，不解错误原因，求教，万分感谢。。。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Tue, 29 Jan 2013 22:45:30 +0800</pubDate>
      <link>https://ruby-china.org/topics/8468</link>
      <guid>https://ruby-china.org/topics/8468</guid>
    </item>
    <item>
      <title>请教 postgresql 测试数据库错误问题</title>
      <description>&lt;p&gt;创建测试环境时需要 rake db:test:load(prepare)
但这些命令会重建 test 数据库，而 postgresql 无法使用 db:create 创建数据库
结果手动建立的 test 数据库会被删除，然后 rake 自己又无法创建成功。。。。。。。
不运行 rake db:test:xxxx 也不行。。。
请教如果不将 test 环境切换到 sqlite3 的话，有啥办法可以把这个弄成功呢。。。。万分感谢。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Sat, 26 Jan 2013 23:40:32 +0800</pubDate>
      <link>https://ruby-china.org/topics/8395</link>
      <guid>https://ruby-china.org/topics/8395</guid>
    </item>
    <item>
      <title>咨询一下数据库表名称问题</title>
      <description>&lt;p&gt;为啥以 data 结尾的 model 建立的表都是单数，比如 gamedata，userdata 等等
但其余都是复数呢？比如 games, users?
因为自作主张把默认生成的 migration 生成的单数表改成复数表结果悲剧了，说是没有相应关系。。。。。。想问一下数据库相应的设定是什么？
我再把生成的后缀 datas 表删除会有问题吗？反正 schema.rb 里面记录是生成了*datas 表的，删不删除倒无所谓，但不知道会不会影响其余信息的使用。。。。。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Mon, 29 Oct 2012 20:09:47 +0800</pubDate>
      <link>https://ruby-china.org/topics/6391</link>
      <guid>https://ruby-china.org/topics/6391</guid>
    </item>
    <item>
      <title>使用 ruby-china 的问题</title>
      <description>&lt;p&gt;安装注册什么都没问题
但想用控制台 (rails c) 看看数据时，就出问题了
User.all
=&amp;gt;
translation missing: zh-CN.mongoid.inspection.criteria&lt;/p&gt;

&lt;p&gt;但我在 zh-CN.yml 中没看到 mongoid 下有 inspection 这项啊。。。这是怎么回事呢？
谢谢。&lt;/p&gt;

&lt;p&gt;User.find(1) 没有问题。&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Wed, 26 Sep 2012 20:26:49 +0800</pubDate>
      <link>https://ruby-china.org/topics/5768</link>
      <guid>https://ruby-china.org/topics/5768</guid>
    </item>
    <item>
      <title>关于《元编程》中 block 作为参数的问题</title>
      <description>&lt;p&gt;&lt;strong&gt;元编程&lt;/strong&gt;这本书 3.7 小节中，使用块作为块的参数并且将其作为 Proc 对象使用。
    &lt;code&gt;Kernel.send :define_method, :event do |name, &amp;amp;block|&lt;/code&gt;
      &lt;code&gt;events[name] = block&lt;/code&gt;
    &lt;code&gt;end&lt;/code&gt;
但这显然行不通，会出现“stack level too deep (SystemStackError)”的错误，如果是运行块倒好办，直接用 yield 就行了。只是这里要用作对象，怎么弄呢？
盼指教！&lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Fri, 27 Jul 2012 22:25:35 +0800</pubDate>
      <link>https://ruby-china.org/topics/4606</link>
      <guid>https://ruby-china.org/topics/4606</guid>
    </item>
    <item>
      <title>问一个关于编码的问题</title>
      <description>&lt;p&gt;使用 csv 模块读取 csv 格式的 utf-8 文本，类似于这样的：
xiaoli，小李，经理，男
xiaowang，小王，助理，女
data=CSV.read('data.txt') 读取
而后将其转成 people[:xiaoli] 形式的 hash 表，奇怪的事情发生了：
转的时候用的是 data[0][0].to_sym 作为 hash 的符号索引，读取的时候直接输入 people['xiaoli'.to_sym] 的时候发生如下错误：
in &lt;code&gt;get_name': undefined method&lt;/code&gt;[]' for nil:NilClass (NoMethodError)
意味着'xiaoli'.to_sym 不等于 data[0][0].to_sym，直接测试
'xiaoli'.to_sym == data[0][0].to_sym 输出 false。。。。。。
从 data 中再读取使用 people[data[0][0].to_sym] 没有问题
此问题只在 windows 中发生，最诡异的是，只有第一行数据会发生这个错误，以后的数据都不会。如果将其他行的数据 copy 到第一行，那么新 copy 到第一行的数据发生这个错误，旧的第一行错误消失。。。。。。
直接新建文档手工写入数据保存成 utf-8 文件错误同样。
真是愁坏了，不知道有没有谁遇到过的？请多多指教，万分感谢。  &lt;/p&gt;</description>
      <author>adventurelw</author>
      <pubDate>Thu, 19 Apr 2012 23:57:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/2744</link>
      <guid>https://ruby-china.org/topics/2744</guid>
    </item>
  </channel>
</rss>
