http://www.railstutorial.org/book/user_microposts 练习第 6 题:Very long words currently break our layout, as shown in Figure 10.18. Fix this problem using the wrap helper defined in Listing 10.47. Note the use of the raw method to prevent Rails from escaping the resulting HTML, together with the sanitize method needed to prevent cross-site scripting. This code also uses the strange-looking but useful ternary operator。
按教程增加了一个 MicropostsHelper,定义了 wrap(content) 方法,发现不起作用,需要在哪里调用吗还是自动使用 helper 中方法过滤。 我的代码提交在https://github.com/LinuxGit/weibo/blob/master/app/helpers/microposts_helper.rb 求教,谢谢,这块困了不少时间。