diff options
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/extensions/object.rb | 2 | ||||
-rw-r--r-- | lib/arel/predicates.rb | 2 | ||||
-rw-r--r-- | lib/arel/primitives/attribute.rb | 2 | ||||
-rw-r--r-- | lib/arel/primitives/expression.rb | 4 | ||||
-rw-r--r-- | lib/arel/primitives/value.rb | 4 | ||||
-rw-r--r-- | lib/arel/sql/formatters.rb | 14 |
6 files changed, 11 insertions, 17 deletions
diff --git a/lib/arel/extensions/object.rb b/lib/arel/extensions/object.rb index 9b66fcac4e..ea73c336dc 100644 --- a/lib/arel/extensions/object.rb +++ b/lib/arel/extensions/object.rb @@ -3,7 +3,7 @@ class Object Arel::Value.new(self, relation) end - def circle(relation) + def find_correlate_in(relation) bind(relation) end diff --git a/lib/arel/predicates.rb b/lib/arel/predicates.rb index 48283e5d09..b375f37ff4 100644 --- a/lib/arel/predicates.rb +++ b/lib/arel/predicates.rb @@ -17,7 +17,7 @@ module Arel end def bind(relation) - self.class.new(operand1.circle(relation), operand2.circle(relation)) + self.class.new(operand1.find_correlate_in(relation), operand2.find_correlate_in(relation)) end def to_sql(formatter = nil) diff --git a/lib/arel/primitives/attribute.rb b/lib/arel/primitives/attribute.rb index eeea495b09..011b751a1d 100644 --- a/lib/arel/primitives/attribute.rb +++ b/lib/arel/primitives/attribute.rb @@ -45,7 +45,7 @@ module Arel @original_attribute ||= history.detect { |a| !a.join? } end - def circle(relation) + def find_correlate_in(relation) relation[self] end diff --git a/lib/arel/primitives/expression.rb b/lib/arel/primitives/expression.rb index 76b76538c9..696e3521be 100644 --- a/lib/arel/primitives/expression.rb +++ b/lib/arel/primitives/expression.rb @@ -29,10 +29,8 @@ module Arel Expression.new(attribute, function_sql, aliaz, self) end - # FIXME def bind(new_relation) - # new_relation == relation ? self : Expression.new(attribute.bind(new_relation), function_sql, @alias, self) - self + new_relation == relation ? self : Expression.new(attribute.bind(new_relation), function_sql, @alias, self) end def to_attribute diff --git a/lib/arel/primitives/value.rb b/lib/arel/primitives/value.rb index 7751390be6..b4bddd0b0c 100644 --- a/lib/arel/primitives/value.rb +++ b/lib/arel/primitives/value.rb @@ -24,9 +24,5 @@ module Arel def bind(relation) Value.new(value, relation) end - - def circle(relation) - bind(relation) - end end end
\ No newline at end of file diff --git a/lib/arel/sql/formatters.rb b/lib/arel/sql/formatters.rb index 5eab65726e..cc7a1fa7d5 100644 --- a/lib/arel/sql/formatters.rb +++ b/lib/arel/sql/formatters.rb @@ -20,8 +20,8 @@ module Arel "#{expression.function_sql}(#{expression.attribute.to_sql(self)})" + (expression.alias ? " AS #{quote_column_name(expression.alias)}" : '') end - def select(select_sql, name) - "(#{select_sql}) AS #{quote_table_name(name.to_s)}" + def select(select_sql, table) + "(#{select_sql}) AS #{quote_table_name(table)}" end def value(value) @@ -67,24 +67,24 @@ module Arel quote(value, column) end - def select(select_sql, name) + def select(select_sql, table) "(#{select_sql})" end end class SelectStatement < Formatter - def select(select_sql, name) + def select(select_sql, table) select_sql end end class TableReference < Formatter - def select(select_sql, name) - "(#{select_sql}) AS #{quote_table_name(name)}" + def select(select_sql, table) + "(#{select_sql}) AS #{quote_table_name(table)}" end def table(table) - quote_table_name(table.name) + (table.name != name_for(table) ? " AS " + engine.quote_table_name(name_for(table)) : '') + quote_table_name(table.name) + (table.name != name_for(table) ? " AS " + quote_table_name(name_for(table)) : '') end end |