aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/engines/sql/relations/compiler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/engines/sql/relations/compiler.rb')
-rw-r--r--lib/arel/engines/sql/relations/compiler.rb7
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