提交 ef493c92 编写于 作者: R Ryan Bigg

Don't use arel_table in published_and_commented example in querying guide

上级 83d4ce6a
......@@ -1004,7 +1004,7 @@ Scopes are also chainable within scopes:
<ruby>
class Post < ActiveRecord::Base
scope :published, -> { where(:published => true) }
scope :published_and_commented, -> { published.and(self.arel_table[:comments_count].gt(0)) }
scope :published_and_commented, -> { published.where("comments_count > 0") }
end
</ruby>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册