<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>weiwei5987</title>
    <link>https://ruby-china.org/weiwei5987</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>关于选择 session 还是 localstorage 存储数据以及相关出错处理的问题</title>
      <description>&lt;p&gt;问题背景：需要将用户多个查询的条件记录下来，在用户再次进入页面的时候直接展示对应查询条件的查询结果&lt;/p&gt;

&lt;p&gt;问题：
1.将查询条件记录在 session 中还是 localstorage 中？
2.不论上述那种情况，都有数据被清除的潜在风险。session 会过期，localstorage 会被清除。这时需要在代码中做数据失效的处理，该如何做？&lt;/p&gt;

&lt;p&gt;不知道有没有把问题描述清楚。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Fri, 26 Aug 2016 11:11:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/30913</link>
      <guid>https://ruby-china.org/topics/30913</guid>
    </item>
    <item>
      <title>关于 Rack-based web framework 的问题，除了 Rack 还有其它吗？</title>
      <description>&lt;p&gt;这个词一直不能很好的理解&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;什么叫 Rack-based web framework，&lt;/li&gt;
&lt;li&gt;除了这种 web framework，ruby 世界中还有别的类型的 web framework？&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;求高手简单指导指导，谢谢&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Thu, 28 Jul 2016 11:09:43 +0800</pubDate>
      <link>https://ruby-china.org/topics/30656</link>
      <guid>https://ruby-china.org/topics/30656</guid>
    </item>
    <item>
      <title>求教一个如何将"按钮"内容提交表单的思路</title>
      <description>&lt;p&gt;起因是这样的，在做一个表单的时候想让用户通过按钮选择数据类型。举个例子：&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2016/66f49b1762efb26dfb31f719a475dfb4.jpg" width="320px" alt=""&gt;&lt;/p&gt;

&lt;p&gt;在这个 APP 中，上方的类型是通过按钮点击选择的。我在网页上也想实现相同的效果。
但是如果使用 button，HTML 的 button 内容是不会往服务器提交的 (原来以为使用 input type=button 就可以，因为毕竟是个 input)&lt;/p&gt;
&lt;h3 id="我想问的问题如下："&gt;我想问的问题如下：&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;使用 radio button，可以将 radio button 的样式调整为一个普通的 button 么？&lt;/li&gt;
&lt;li&gt;知乎上有说使用 img，a，div 标签来伪装 button，这个可行么？&lt;/li&gt;
&lt;li&gt;如果使用 hidden_field 来提交内容，使用 button 来展示，通过 js 控制 hidden_field 的值，这种方法是否安全？&lt;/li&gt;
&lt;li&gt;这种页面一般的实现思路是什么？&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;因为对 HTML 基础比较弱，如果问题哪里提的不合理，还请指正。谢谢&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Thu, 24 Mar 2016 07:57:41 +0800</pubDate>
      <link>https://ruby-china.org/topics/29434</link>
      <guid>https://ruby-china.org/topics/29434</guid>
    </item>
    <item>
      <title> Form Builder 的 label for radio button 的 locales 文件该如何写</title>
      <description>&lt;p&gt;在 form 中，如果是 text_field，那么视图文件可以像下面这么写：&lt;/p&gt;
&lt;pre class="highlight erb"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"field"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;label&lt;/span&gt; &lt;span class="ss"&gt;:amounts&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;br&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text_field&lt;/span&gt; &lt;span class="ss"&gt;:amounts&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;对应的 locales 文件呢，可以如下写：&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;helpers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;account_record&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;amounts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;金额"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是如果是 radio button，视图文件得写成这样：&lt;/p&gt;
&lt;pre class="highlight erb"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"field"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;radio_button&lt;/span&gt; &lt;span class="ss"&gt;:incoming_or_outgoing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'incoming'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:checked&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;label&lt;/span&gt; &lt;span class="ss"&gt;:incoming_or_outgoing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;I18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:incoming&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="ss"&gt;:value&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'incoming'&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;radio_button&lt;/span&gt; &lt;span class="ss"&gt;:incoming_or_outgoing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'outgoing'&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;label&lt;/span&gt; &lt;span class="ss"&gt;:incoming_or_outgoing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;I18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:outgoing&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="ss"&gt;:value&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'outgoing'&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;对应的 locals 文件没法把 incoming 和 outgoing 放在 Model 下面了。。。&lt;/p&gt;

&lt;p&gt;请问该如何解决呢？谢谢回答。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Fri, 07 Aug 2015 22:59:10 +0800</pubDate>
      <link>https://ruby-china.org/topics/26823</link>
      <guid>https://ruby-china.org/topics/26823</guid>
    </item>
    <item>
      <title>remote_function 是不是需要 rails 添加 prototype 支持才行？</title>
      <description>&lt;p&gt;remote_function 是不是已经过时了？&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Tue, 26 Aug 2014 23:38:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/21239</link>
      <guid>https://ruby-china.org/topics/21239</guid>
    </item>
    <item>
      <title>想学习 ruby-china 的源码</title>
      <description>&lt;p&gt;一直找不到头绪，各位大神有没有什么建议呢~&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Tue, 25 Jun 2013 11:26:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/11973</link>
      <guid>https://ruby-china.org/topics/11973</guid>
    </item>
    <item>
      <title>assets precompile 的问题</title>
      <description>&lt;p&gt;&lt;a href="http://edgeguides.rubyonrails.org/asset_pipeline.html#precompiling-assets" rel="nofollow" target="_blank"&gt;http://edgeguides.rubyonrails.org/asset_pipeline.html#precompiling-assets&lt;/a&gt;中&lt;/p&gt;

&lt;p&gt;When using asset precompilation (the production default), you will need to ensure that your controller assets will be precompiled when loading them on a per page basis. By default .coffee and .scss files will not be precompiled on their own. This will result in false positives during development as these files will work just fine since assets will be compiled on the fly. When running in production however, you will see 500 errors since live compilation is turned off by default.   &lt;/p&gt;

&lt;p&gt;这几句该怎么理解啊，不懂求教。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Thu, 06 Jun 2013 10:16:54 +0800</pubDate>
      <link>https://ruby-china.org/topics/11531</link>
      <guid>https://ruby-china.org/topics/11531</guid>
    </item>
    <item>
      <title>public 目录 VS assets 目录</title>
      <description>&lt;p&gt;这两个目录怎么用呢，感觉现在 public 目录有点没用的感觉。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Wed, 05 Jun 2013 08:45:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/11494</link>
      <guid>https://ruby-china.org/topics/11494</guid>
    </item>
    <item>
      <title>web 开发敏捷之道遇到 rvm</title>
      <description>&lt;p&gt;在 web 开发敏捷之道第 4 版第 16 章“部署”中，因为我用的是 rvm，导致 passenger 被安装在/home/fedora/.rvm/gems/ruby-1.9.2-p320/gems/目录下，因此 apache 没法 load passenger。求支招。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Thu, 13 Dec 2012 16:08:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/7531</link>
      <guid>https://ruby-china.org/topics/7531</guid>
    </item>
    <item>
      <title>被调用的函数都很短小，参数却很大</title>
      <description>&lt;p&gt;有没有像 c++  内联函数那样的方法，可以让我的代码如果修改的话，修改起来轻松点&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Fri, 19 Oct 2012 15:54:25 +0800</pubDate>
      <link>https://ruby-china.org/topics/6184</link>
      <guid>https://ruby-china.org/topics/6184</guid>
    </item>
    <item>
      <title>ActiveRecord 和 ActiveModel 的区别与联系</title>
      <description>&lt;p&gt;如题。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Tue, 16 Oct 2012 20:19:01 +0800</pubDate>
      <link>https://ruby-china.org/topics/6099</link>
      <guid>https://ruby-china.org/topics/6099</guid>
    </item>
    <item>
      <title>ruby 中如何定位 DAO</title>
      <description>&lt;p&gt;我的实体类已经继承了 ActiveRecord，那么对这个类增删改查的封装是不是也写在这个 model 里面，还是在 model 上再封装一层 DAO 呢？比如已经写了 Task 类继承自 ActiveRecord 了，那么 create_task 这个函数是放在 Task 类里还是放在新类里。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Tue, 16 Oct 2012 11:31:14 +0800</pubDate>
      <link>https://ruby-china.org/topics/6089</link>
      <guid>https://ruby-china.org/topics/6089</guid>
    </item>
    <item>
      <title>如何为 ActiveRecord 指定 database.yaml</title>
      <description>&lt;p&gt;现在有个小实验，仅用到了 ActiveRecord，然后我就不知道怎么载入 database.yaml 来配置数据库了&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Tue, 16 Oct 2012 10:22:01 +0800</pubDate>
      <link>https://ruby-china.org/topics/6087</link>
      <guid>https://ruby-china.org/topics/6087</guid>
    </item>
    <item>
      <title>WEBrick 无法从外部访问？？？</title>
      <description>&lt;p&gt;在虚拟机里安装的 rails，并且在虚拟机里可以用&lt;a href="http://127.0.0.1:3000" rel="nofollow" target="_blank"&gt;http://127.0.0.1:3000&lt;/a&gt; 访问，为什么我在本机上通过虚拟机的 ip 访问 WEBrick 就不能访问到了呢。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Sat, 01 Sep 2012 11:42:59 +0800</pubDate>
      <link>https://ruby-china.org/topics/5296</link>
      <guid>https://ruby-china.org/topics/5296</guid>
    </item>
    <item>
      <title>Fedora 下 Rails 权限问题</title>
      <description>&lt;p&gt;用的是普通用户创建的项目，没法 bundle install，用 root 用户 bundle install 的，结果 Gemfile.lock 变成 root 权限了，接下来 generate scaffold 的时候就有 Gemfile.lock 权限错误了，菜鸟求喷～～&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Tue, 28 Aug 2012 09:32:59 +0800</pubDate>
      <link>https://ruby-china.org/topics/5197</link>
      <guid>https://ruby-china.org/topics/5197</guid>
    </item>
    <item>
      <title>我已经 gem install 了 execjs 和 therubyracer，为何 Gemfile 中却没有</title>
      <description>&lt;p&gt;如题，遇到了 autodetect': Could not find a JavaScript runtime.这个错误，网上都是说的直接修改 Gemfile，觉得有点暴力，就想 gem install execjs 和 therubyracer 应该可以，结果却不是我想的那样。请指导。&lt;/p&gt;</description>
      <author>weiwei5987</author>
      <pubDate>Tue, 24 Jul 2012 23:03:52 +0800</pubDate>
      <link>https://ruby-china.org/topics/4531</link>
      <guid>https://ruby-china.org/topics/4531</guid>
    </item>
  </channel>
</rss>
