1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't use arel_table in published_and_commented example in querying guide

This commit is contained in:
Ryan Bigg 2012-04-07 11:23:47 -05:00
parent 83d4ce6a25
commit ef493c9259

View file

@ -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>