<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>dreamable (dreamable)</title>
    <link>https://ruby-china.org/dreamable</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>大家网页输入的 Editor 一般用什么 Gem 啊</title>
      <description>&lt;p&gt;类似 ruby-china 发帖的界面。writings.io 很漂亮，但是可能比较难。只需要提供基本的输入格式，ruby-china 的这样就可以了，有什么好的 gem 可以直接用？将来可能要支持自己定义的扩展格式，比如自定义格式。有没有大家惯用的解决方法。&lt;/p&gt;</description>
      <author>dreamable</author>
      <pubDate>Wed, 24 Apr 2013 15:25:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/10465</link>
      <guid>https://ruby-china.org/topics/10465</guid>
    </item>
    <item>
      <title>I18n 当 locale 是 en 如何不翻译？</title>
      <description>&lt;p&gt;默认的 Locale 是 EN，支持 ZN，并提供了 zh.yml。当 Locale 是 ZH 的时候没有问题，但是当是 EN 的时候报 translation missing 错误。例如
     t("hello")
zh.yml
     hello: 你好
en.yml // 空文件 &lt;/p&gt;

&lt;p&gt;我知道在 en.yml 中加入 "hello: hello"可以解决问题。但是这不是很傻么？能不能设置一下，让 I18n 在默认 locale 下直接用显示，不再报错？&lt;/p&gt;

&lt;p&gt;谢谢。&lt;/p&gt;</description>
      <author>dreamable</author>
      <pubDate>Sun, 14 Apr 2013 02:01:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/10171</link>
      <guid>https://ruby-china.org/topics/10171</guid>
    </item>
    <item>
      <title>大家都是怎么做 Test 的</title>
      <description>&lt;p&gt;今天看了一下《Agile Web Development with Rails》中的 Test，感觉不太实用。一个是写起测试来太复杂了，再就是没有页面测试直观，最后就是初期代码逻辑可能不停的换，Test 代码也要相应改变，双重负担。
不知道大家平时都是怎么测试，是手动在浏览器里调试，还是在 test 目录下写代码自动测试？有什么经验可以分享？&lt;/p&gt;</description>
      <author>dreamable</author>
      <pubDate>Thu, 28 Mar 2013 13:25:04 +0800</pubDate>
      <link>https://ruby-china.org/topics/9812</link>
      <guid>https://ruby-china.org/topics/9812</guid>
    </item>
    <item>
      <title>是不是应该慎用 namespace model</title>
      <description>&lt;p&gt;我有一个 Fruit 的父类和 Apple 和 Orange 的子类。我最开始想象 Ruby-China 中 notification 那样都放到一个 Fruit 的 namespace 中。结果出现好多问题，解决了很多，最后的 form_for link_for 等还是不 work。只好放弃。其实我只是不想把太多的类放到 app/models 下，不存在名字冲突的矛盾。所以最后创建了 app/models/fruit 目录，然后把这些类都放到里面去，一样方便管理。
是不是最好不要使用 namespace model？namespace 一般什么时候使用？&lt;/p&gt;</description>
      <author>dreamable</author>
      <pubDate>Fri, 01 Feb 2013 16:10:00 +0800</pubDate>
      <link>https://ruby-china.org/topics/8552</link>
      <guid>https://ruby-china.org/topics/8552</guid>
    </item>
    <item>
      <title>form_for 数组问题</title>
      <description>&lt;p&gt;我有一个类 MultipleChoice，有 4-5 个 options. options 是一个 String Array，在 DB 中是存储在一起的：“#opt1#opt2#opt3#opt4....”. 我在 Model 中实现了 options 的 reader 和 setter. &lt;/p&gt;

&lt;p&gt;但是不知道如何在 form_for 表格中对 options 赋值。我先是使用
&lt;code&gt;&amp;lt;%f.text_area :options%&amp;gt;&lt;/code&gt;
但是这样用户需要输入字符串"#opt1#opt2...",而我想要的是提供给用户四个单独的输入框，内部存储格式对用户是透明的。&lt;/p&gt;

&lt;p&gt;现在的方法是实现了 opt1 opt2 opt3 opt4 函数的 reader 和 setter，form_for 中使用
&lt;code&gt;&amp;lt;%f.text_area :opt1 %&amp;gt;&lt;/code&gt;
&lt;code&gt;&amp;lt;%f.text_area :opt2 %&amp;gt;&lt;/code&gt;
&lt;code&gt;&amp;lt;%f.text_area :opt3 %&amp;gt;&lt;/code&gt;
&lt;code&gt;&amp;lt;%f.text_area :opt4 %&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;这样可以用，但是代码很烂。我查找了 form_for 和 fields_for 的说明，也没有什么好办法。不知道大家有什么好办法。有没有办法让用户输入单独的“opt1”,..."opt4"，而表单自动将之转成字符串数组，通过 options=函数赋值？&lt;/p&gt;

&lt;p&gt;DB 层没法改，因为 MultipleChoice 是一个子类，和父类共享一个表格。&lt;/p&gt;</description>
      <author>dreamable</author>
      <pubDate>Tue, 15 Jan 2013 14:58:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/8084</link>
      <guid>https://ruby-china.org/topics/8084</guid>
    </item>
    <item>
      <title>使用继承技术的例子？</title>
      <description>&lt;p&gt;我想学学在 Rails 中如何使用继承，找的资料都是 STI 相关的，这个只是 Model 层的。之上的 Controller 和 Views 如何实现没概念，有人知道有类似的例子么，学习一下别人的实现代码。
谢谢。&lt;/p&gt;</description>
      <author>dreamable</author>
      <pubDate>Thu, 10 Jan 2013 04:29:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/7922</link>
      <guid>https://ruby-china.org/topics/7922</guid>
    </item>
  </channel>
</rss>
