囧
用实例变量目的在于view中好调用
这理由不成立呀 常量更可以直接调用
<% Array(@c).each_with_index do |c, index| %>
#donothing
<%end%>
PS. RubyChina 快成了问答网站了..
是的 erubis 兼容 erb 并且可以自动过滤敏感标签。。
显然是没保存成功
http://rubylearning.com/blog/2012/04/23/ruby-in-2012/ What is your opinion on Node.js? Is this the future? Do you think Node.js will beat Ruby in web application development?
Matt Aimonetti: This is a question I often get. I personally like node.js, I think it’s fun, easy to get started and with CoffeeScript, writing JavaScript (JS) is almost fun. That said, Node is really young, not very well documented and relies extremely heavily on callbacks which can be quite confusing at times. My experience with Node is limited, but as my personal project started growing, I started struggling to keep my code simple and easy to maintain. Because I already know Ruby quite well and because equivalent tools exist in Ruby land, I don’t see a real need to use Node besides being the new cool framework.
But the project is fast growing, the cross-platform focus is welcomed and I think that for some developers, Node.js can be a great solution, especially when developing simple web APIs.
Will it “beat” Ruby? Well, a framework and a programming language are two different things. Will it beat Rails in popularity, that’s a possibility due to the fact that JavaScript is becoming very popular. However, some of the issues I mentioned earlier might prevent Node.js to become as popular as some people seem to believe. Finally, at the end of the day, if a JS framework becomes a better solution than anything else I use, I will certainly switch. But so far, I don’t see that happening.
在这里讨论身价过亿编程正不正常一点意义也木有。。。
"Ruby has no limitation, the only limitation is your imagination."
支持
杭州是个好地方
支持:
array.paginate(:page => xx, :per_page => xxx)
Rails3.2 居然还用 mysql 驱动!!
#73 楼 @reyesyang :-)
优化方法很多啊 1.使用 MyISAM 表,count 很快的,因为是预先计算出来的。不过带 where 的 count 会慢。 2.使用 counter cache: 比如用户文章列表页面:把文章数量存在用户表里,分页的时候直接指定 total_entries => user.articles_count
3.计数表: 有些表是没有根的,像 user 表。可以直接创建一个计数用的表用来存储用户总数量,帖子数量,全局访问量等信息。同样是 counter cache 的思路。在分页的时候指定 total_entries => users_count
4.限制翻页数,比如淘宝的商品最多显示 100 页。
counter cache 和计数表
来晚了。。。
推荐一个豆列:http://book.douban.com/doulist/1518168/
可能还需要一些前端和测试方面的,我不熟悉。。