diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-16 15:41:27 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-16 15:41:27 -0700 |
commit | ed9c8d4d828fe4e28c1e37ed8921acbee54450f2 (patch) | |
tree | f650c5b558a21683e55169fbb1defe614733f725 /lib/active_relation/primitives | |
parent | 1a6a3a1c6aa2f75333edef9100951407c4f76f1f (diff) | |
download | rails-ed9c8d4d828fe4e28c1e37ed8921acbee54450f2.tar.gz rails-ed9c8d4d828fe4e28c1e37ed8921acbee54450f2.tar.bz2 rails-ed9c8d4d828fe4e28c1e37ed8921acbee54450f2.zip |
renamed strategy to formatter
Diffstat (limited to 'lib/active_relation/primitives')
-rw-r--r-- | lib/active_relation/primitives/attribute.rb | 8 | ||||
-rw-r--r-- | lib/active_relation/primitives/expression.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/primitives/value.rb | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/active_relation/primitives/attribute.rb b/lib/active_relation/primitives/attribute.rb index f2c484cc59..fc857347fc 100644 --- a/lib/active_relation/primitives/attribute.rb +++ b/lib/active_relation/primitives/attribute.rb @@ -111,16 +111,16 @@ module ActiveRelation end include Expressions - def to_sql(strategy = Sql::WhereCondition.new(engine)) - strategy.attribute prefix, name, self.alias + def to_sql(formatter = Sql::WhereCondition.new(engine)) + formatter.attribute prefix, name, self.alias end def format(object) - object.to_sql(strategy) + object.to_sql(formatter) end private - def strategy + def formatter Sql::Attribute.new(self) end diff --git a/lib/active_relation/primitives/expression.rb b/lib/active_relation/primitives/expression.rb index 11aa558977..2df2888ba0 100644 --- a/lib/active_relation/primitives/expression.rb +++ b/lib/active_relation/primitives/expression.rb @@ -25,7 +25,7 @@ module ActiveRelation end include Transformations - def to_sql(strategy = nil) + def to_sql(formatter = nil) "#{function_sql}(#{attribute.to_sql})" + (@alias ? " AS #{quote_column_name(@alias)}" : '') end diff --git a/lib/active_relation/primitives/value.rb b/lib/active_relation/primitives/value.rb index 096c876ecd..131610f2e9 100644 --- a/lib/active_relation/primitives/value.rb +++ b/lib/active_relation/primitives/value.rb @@ -6,8 +6,8 @@ module ActiveRelation @value, @relation = value, relation end - def to_sql(strategy = Sql::WhereCondition.new(relation.engine)) - strategy.value value + def to_sql(formatter = Sql::WhereCondition.new(relation.engine)) + formatter.value value end def format(object) |