AND,不要忘了 Mongodb 可以对数组字段建索引。
#7 楼 @Yujing_Z 其实就算有查找用户关注的所有帖子功能,也可能是在 Topic 单边存 like_ids 更快。
以前做过性能测试,不过测试脚本不小心删了,仅供参考,最好自己试一试 http://codecampo.com/topics/168
清除 User 的 like 数据我在 4 楼已经说了
Topic.where(like_ids: user.id).pull(:like_ids: user.id)
这个操作 Mongodb 可以批量执行啊。update_all
AND,理解 HTML 元素的语义。https://developer.mozilla.org/zh-CN/docs/HTML/HTML5
我更关注 Open Graph,Twitter Card。
#20 楼 @cassiuschen Ruby 是最好的语言啊
{% raw %}
<h3 ng-bind-template='{{ m.Title }}'></h3>
...
{% endraw %}
$97,184 pledged of $10,000 goal
:shipit:
“下面我们来连线前方的记者” “下面交还给演播室”
Code statistics for Basecamp Next
http://37signals.com/svn/posts/3094-code-statistics-for-basecamp-next
I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence (I suspect this level of confidence is high compared to industry standards, but that could just be hubris).
是 TDD 创始人 Kent Beck 说的,而且别脱离上下文理解: http://stackoverflow.com/questions/153234/how-deep-are-your-unit-tests
如果只看只言片语就“奥!Kent Beck 叫我们不要测试!”,那么以后都跟优秀开发者无缘了。
coffeescript 默认编译出来带一个匿名域,无法在全局域访问里面的方法。虽然可以关掉 coffeescript 这个功能,但更好的方案是明确把要暴露的方法放到全局:
window.map = ->
# or
youApp.map = ->
The Rails Way 要看 Basecamp
从 star 数看 at.js 已经是流行项目了啊
#49 楼 @yuh http://backbonejs.org/#examples 这个列表依然给我强劲的信心
赞!
提点建议:
比较奇怪,默认应该就是转化为 true/false 的。
我两个文档都啃了两次,动手的时候发现一个问题:为什么要把一个应用拆成两个徒增代码量,所有变量传递都改成 API?
后来 DHH 写了 SJR 那篇文章(http://37signals.com/svn/posts/3697-server-generated-javascript-responses),我发现 Basecamp 方案就是我要的。
#44 楼 @cassiuschen 这篇文章的意思是,在有的语言好的实践放在另一个语言可能是坏实践。融会贯通有好也有坏,把一个语言的经验不能照搬到另一个。DHH 这样的程序员选择精通一个,而不是做语言大师。
说得通俗的就是,不要浑身是刀,没一把锋利。
That's the real point here: Be careful with who you share your intellectual foundation with. It's fashionable to say "I'm not a Ruby programmer, I'm just a programmer". But languages shape the way we think. While we can cross-pollinate some ideas between languages, there are many we cannot. And worse, the incompatibility is not immediately apparent — especially when they both seem to just be Objective Oriented.
I'm a Ruby programmer. —— By David Heinemeier Hansson on Jan 6, 2013 http://david.heinemeierhansson.com/2012/dependency-injection-is-not-a-virtue.html
#11 楼 @satoshigi 从数据管理角度,这是两个物品了。一般电商网站会保留所有商品信息和订单信息,商品条目只会软删除,你需要的 prize 表,比较像订单。
LEVEL_TABLE = [100, 200, 500]
def level
LEVEL_TABLE.index { |exp| exp > self.exp }
end
#9 楼 @satoshigi 我觉得礼物的 id 是不变的啊,比如有 ID 为 1~10 的物品,今天允许选 1~6,明天允许选 5~9,但是礼物的 id 没变啊。
#7 楼 @satoshigi 意思是顶楼的 prize 表已经是关联表吗?补充一些详细的业务描述和数据描述,现在看不明白,为什么 prize 表里面同时有 id 和 prize_id,prize_id 指向哪?