<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>ZhongWen_Zhou (What)</title>
    <link>https://ruby-china.org/ZhongWen_Zhou</link>
    <description>come on, boy</description>
    <language>en-us</language>
    <item>
      <title>Kindeditor 和 rails 结合使用时得 csrf 问题解决</title>
      <description>&lt;p&gt;总之，不用 csrf 肯定会有问题，谁都不愿意来冒这个风险，但是 kindeditor 又没有支持，找了一下，发现这个是最简单得一种，贴出来，让大家少走点弯路
&lt;a href="http://www.cnblogs.com/yeelone/archive/2012/11/17/2774466.html" rel="nofollow" target="_blank"&gt;http://www.cnblogs.com/yeelone/archive/2012/11/17/2774466.html&lt;/a&gt;&lt;/p&gt;</description>
      <author>ZhongWen_Zhou</author>
      <pubDate>Wed, 16 Apr 2014 18:12:35 +0800</pubDate>
      <link>https://ruby-china.org/topics/18640</link>
      <guid>https://ruby-china.org/topics/18640</guid>
    </item>
    <item>
      <title>ruby-china 在 IE 下无法正常显示？！</title>
      <description>&lt;p&gt;因为用了 ruby-china 的源码搭一个 bbs，结果发现在 ie 下无法正常显示啊，样式全乱了！这可怎么办啊，不能给客户说只能用这个 chrome 或 ff 吧，国内的很多用户还是 ie 或 360 啥的&lt;/p&gt;

&lt;p&gt;求指导&lt;/p&gt;</description>
      <author>ZhongWen_Zhou</author>
      <pubDate>Sat, 01 Mar 2014 12:18:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/17588</link>
      <guid>https://ruby-china.org/topics/17588</guid>
    </item>
    <item>
      <title>请教一个 js 模板问题</title>
      <description>&lt;p&gt;背景：
       在页面中有很多 弹出框，这些弹出框目前是用 js 拼接 html 字符串然后使用 template engine 替换得来的，但是这样不好统一管理维护也困难。&lt;/p&gt;

&lt;p&gt;我是想把所有的这些 template 都放在服务端，然后在 js 里通过&amp;lt;%= render %&amp;gt;这样的形式引入进来，但是这些 js 文件都直接是 assets/js 下面的初始文件，没有经过 controller，所以没有办法使用 render 方法来渲染，请问针对这个问题有什么好的解决方式么&lt;/p&gt;

&lt;p&gt;请各位大牛出个主意&lt;/p&gt;</description>
      <author>ZhongWen_Zhou</author>
      <pubDate>Wed, 26 Feb 2014 12:05:28 +0800</pubDate>
      <link>https://ruby-china.org/topics/17495</link>
      <guid>https://ruby-china.org/topics/17495</guid>
    </item>
    <item>
      <title>请教根据 cookie 来识别 session 是在哪里处理的</title>
      <description>&lt;p&gt;最近闲来无事，打算看看 Webrick 怎么处理请求，又怎么交给 rack，然后再交给 framework 来处理的，看到 cookie 这里就卡住了，我是想找到如何根据 cookie 来找到是同一个 session 的！
在 webrick 中通过解析 http 协议的头部来为 http_request 的 cookie 来赋值的，但是并没有提及 session 的管理，于是我又找到 rack 中去，发现 rack 中也没有对于 session 的管理，虽然他说了基于 Rack::Session::Cookie provides simple cookie based session management.但是我确实发现每一个请求来都是新建了一个{}对象作为 session 的容器，却并没有判断这两个请求是同一个 session，因为还没有看到 framework 这一层，所以想提前问问大家，这个 session 的判断和管理是在 framework 上面处理的么，如果不是，那么这个 webrick 和 rack 对于 session 的管理在哪里呢？
谢谢各位了&lt;/p&gt;</description>
      <author>ZhongWen_Zhou</author>
      <pubDate>Wed, 04 Dec 2013 17:20:35 +0800</pubDate>
      <link>https://ruby-china.org/topics/16002</link>
      <guid>https://ruby-china.org/topics/16002</guid>
    </item>
    <item>
      <title>Rails 中使用 Hash 的小陷阱，不知道各位注意到没有</title>
      <description>&lt;p&gt;背景：通过表单传来的参数，我们可以通过 params[:arg_name] 取得其值，但是偶尔需要 merge 一些新的东西，params = {:other_arg =&amp;gt; value}.merge(params)，此时再用 params[:arg_name] 便无法取得原来的值，后来经过一番折腾，发现如果改为：params = params.merge({:other_arg =&amp;gt; value})，然后通过 params[:arg_name] 就可以取得值，对于这个非常诡异的问题，有如下陷阱，各位不要再掉进去咯&lt;/p&gt;

&lt;p&gt;原来 Rails 再帮我们处理参数的时候，会将 params 转换为 Object::HashWithIndifferentAccess 这样的类型，而这一个类型对于 key 是既可以用 string 也可以用 symbol 的，而这一类型的实例再 merge 一个 hash 对象时，也同样会转换成 Object::HashWithIndifferentAccess 类型。&lt;/p&gt;

&lt;p&gt;相反的，我们的第一种写法，{:other_arg =&amp;gt; value}.merge(params)，这里的{:other_arg =&amp;gt; xxx}本身是一个 ruby 的 hash 对象，不是 Object::HashWithIndifferentAccess 的类型，所以当它再 merge 一个 Object::HashWithIndifferentAccess &amp;lt; Hash 对象时，它只能转型成 ruby 的 hash 对象，而对于 ruby 的 hash 对象，大家都知道 key 是区分 string 和 symbol 的，因此出现了上述问题&lt;/p&gt;</description>
      <author>ZhongWen_Zhou</author>
      <pubDate>Thu, 25 Apr 2013 11:13:03 +0800</pubDate>
      <link>https://ruby-china.org/topics/10493</link>
      <guid>https://ruby-china.org/topics/10493</guid>
    </item>
    <item>
      <title>网站静态化策略求教</title>
      <description>&lt;p&gt;开门见山的介绍：1.  项目以信息展示浏览为主    2.   需要对整个网站前台进行静态化（社区讨论等动态内容除外）3.    项目层级结构较多（栏目 - 栏目 - 文章），更新频率较高（新闻资讯类网站）&lt;/p&gt;

&lt;p&gt;项目以前主要用的 redis 做缓存，没有页面缓存。因为属于新手，没有这方面的经验，查阅过一些资料，也做过一些实验，求高手再指教指教&lt;/p&gt;

&lt;p&gt;个人想法及实验：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;  layout 中不再通过 render partial 引入其他部分，而通过 iframe&lt;/li&gt;
&lt;li&gt;  iframe 引用的页面根据内容划分为静态的纯 html 页面，及动态的 url 请求返回（这时可用 redis 根据特定信息缓存页面片段）&lt;/li&gt;
&lt;li&gt;  对整个 action 采用 caches_page，生成静态页面，其中根据布局包含多个 iframe，根据内容则如 2 中所示&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;这已经做过实验是可行的，当然用在项目中可能还会有其他问题，希望有高手分享一下这种 rails 网站静态化的经验。&lt;/p&gt;</description>
      <author>ZhongWen_Zhou</author>
      <pubDate>Mon, 10 Dec 2012 10:04:20 +0800</pubDate>
      <link>https://ruby-china.org/topics/7426</link>
      <guid>https://ruby-china.org/topics/7426</guid>
    </item>
  </channel>
</rss>
