diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-04-06 15:23:56 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-04-06 15:23:56 +0000 |
commit | 52d298a8bd5800d9149b0b288bd8a929110b5260 (patch) | |
tree | 7f6cb3528dd30c9593875c38da820125d4ba8427 /activerecord/lib/active_record | |
parent | 944ae628f529a5392a543a88186415e87f462009 (diff) | |
download | rails-52d298a8bd5800d9149b0b288bd8a929110b5260.tar.gz rails-52d298a8bd5800d9149b0b288bd8a929110b5260.tar.bz2 rails-52d298a8bd5800d9149b0b288bd8a929110b5260.zip |
Enable Limit/Offset in Calculations (closes #4558) [lmarlow@yahoo.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4185 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/calculations.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index a4c6b71398..b62d205201 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -1,6 +1,6 @@ module ActiveRecord module Calculations #:nodoc: - CALCULATIONS_OPTIONS = [:conditions, :joins, :order, :select, :group, :having, :distinct] + CALCULATIONS_OPTIONS = [:conditions, :joins, :order, :select, :group, :having, :distinct, :limit, :offset] def self.included(base) base.extend(ClassMethods) end @@ -153,6 +153,7 @@ module ActiveRecord sql << " GROUP BY #{options[:group_field]}" if options[:group] sql << " HAVING #{options[:having]}" if options[:group] && options[:having] sql << " ORDER BY #{options[:order]}" if options[:order] + add_limit!(sql, options) sql.join end |