diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 17:43:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 17:43:22 -0700 |
commit | c9d025261c14a1972bbad92796e1ba6adcc97d2b (patch) | |
tree | 46e48310886e400f605de321f00f5f104a13bd9b /lib/arel/engines/sql/relations/compiler.rb | |
parent | ae6a14251462597ca13f255c02307f5308062214 (diff) | |
download | rails-c9d025261c14a1972bbad92796e1ba6adcc97d2b.tar.gz rails-c9d025261c14a1972bbad92796e1ba6adcc97d2b.tar.bz2 rails-c9d025261c14a1972bbad92796e1ba6adcc97d2b.zip |
PERF: caching engine, fewer calls to method_missing
Diffstat (limited to 'lib/arel/engines/sql/relations/compiler.rb')
-rw-r--r-- | lib/arel/engines/sql/relations/compiler.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/arel/engines/sql/relations/compiler.rb b/lib/arel/engines/sql/relations/compiler.rb index abd0d0abfd..05a071b4bf 100644 --- a/lib/arel/engines/sql/relations/compiler.rb +++ b/lib/arel/engines/sql/relations/compiler.rb @@ -5,6 +5,7 @@ module Arel def initialize(relation) @relation = relation + @engine = relation.engine end def select_sql @@ -37,7 +38,11 @@ module Arel ("ORDER BY #{orders.join(', ')}" unless orders.empty?) ].compact.join ' ' - engine.add_limit_offset!(clauses,{ :limit => taken, :offset => skipped }) if taken || skipped + offset = relation.skipped + limit = relation.taken + @engine.add_limit_offset!(clauses, :limit => limit, + :offset => offset) if offset || limit + clauses << " #{locked}" unless locked.blank? clauses unless clauses.blank? end |