diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index a89d0f3ebf..1fb4cbe1c4 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -71,8 +71,6 @@ module ActiveRecord # Used to indicate that an association is referenced by an SQL string, and should # therefore be JOINed in any query rather than loaded separately. # - # For example: - # # User.includes(:posts).where("posts.name = 'foo'") # # => Doesn't JOIN the posts table, resulting in an error. # @@ -163,7 +161,6 @@ module ActiveRecord # User.order('email DESC').reorder('id ASC').order('name ASC') # # generates a query with 'ORDER BY id ASC, name ASC'. - # def reorder(*args) args.blank? ? self : spawn.reorder!(*args) end @@ -216,6 +213,13 @@ module ActiveRecord self end + # Specifies a limit of records. + # + # User.limit(10) # generated SQL has 'LIMIT 10' + # + # Replaces any existing previous limit. + # + # User.limit(10).limit(20) # generated SQL has 'LIMIT 20' def limit(value) spawn.limit!(value) end |