diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-11 23:09:15 -0800 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-11 23:09:15 -0800 |
commit | 0d70ce37e510c83d5fc42f88b04314f40d87fe96 (patch) | |
tree | 03183df1b69ebb31bd5148bc8a9443647348ff3a /lib | |
parent | 82cd330dbac31d79e23cc06273321ecbac2b9077 (diff) | |
download | rails-0d70ce37e510c83d5fc42f88b04314f40d87fe96.tar.gz rails-0d70ce37e510c83d5fc42f88b04314f40d87fe96.tar.bz2 rails-0d70ce37e510c83d5fc42f88b04314f40d87fe96.zip |
rename substitute to bind since it 'binds' an object to a new relation.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_relation/extensions/object.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/predicates.rb | 4 | ||||
-rw-r--r-- | lib/active_relation/primitives/attribute.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/primitives/expression.rb | 4 | ||||
-rw-r--r-- | lib/active_relation/relations/aggregation.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/relations/compound.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/relations/join.rb | 4 | ||||
-rw-r--r-- | lib/active_relation/relations/rename.rb | 6 |
8 files changed, 13 insertions, 13 deletions
diff --git a/lib/active_relation/extensions/object.rb b/lib/active_relation/extensions/object.rb index 1db4c845be..35ffa9c661 100644 --- a/lib/active_relation/extensions/object.rb +++ b/lib/active_relation/extensions/object.rb @@ -3,7 +3,7 @@ class Object self end - def substitute(relation) + def bind(relation) self end diff --git a/lib/active_relation/predicates.rb b/lib/active_relation/predicates.rb index 54cc1fa5a0..76288595dc 100644 --- a/lib/active_relation/predicates.rb +++ b/lib/active_relation/predicates.rb @@ -20,8 +20,8 @@ module ActiveRelation self.class.new(attribute.qualify, operand.qualify) end - def substitute(relation) - self.class.new(attribute.substitute(relation), operand.substitute(relation)) + def bind(relation) + self.class.new(attribute.bind(relation), operand.bind(relation)) end def to_sql(strategy = Sql::Predicate.new) diff --git a/lib/active_relation/primitives/attribute.rb b/lib/active_relation/primitives/attribute.rb index 893feefef2..de25a90868 100644 --- a/lib/active_relation/primitives/attribute.rb +++ b/lib/active_relation/primitives/attribute.rb @@ -15,7 +15,7 @@ module ActiveRelation Attribute.new(relation, name, aliaz, self) end - def substitute(new_relation) + def bind(new_relation) relation == new_relation ? self : Attribute.new(new_relation, name, @alias, self) end diff --git a/lib/active_relation/primitives/expression.rb b/lib/active_relation/primitives/expression.rb index ff07c40109..6ff06c7f81 100644 --- a/lib/active_relation/primitives/expression.rb +++ b/lib/active_relation/primitives/expression.rb @@ -10,8 +10,8 @@ module ActiveRelation end module Transformations - def substitute(new_relation) - new_relation == relation ? self : Expression.new(attribute.substitute(new_relation), function_sql, @alias, self) + def bind(new_relation) + new_relation == relation ? self : Expression.new(attribute.bind(new_relation), function_sql, @alias, self) end def as(aliaz) diff --git a/lib/active_relation/relations/aggregation.rb b/lib/active_relation/relations/aggregation.rb index 692a922ca7..9e803b3587 100644 --- a/lib/active_relation/relations/aggregation.rb +++ b/lib/active_relation/relations/aggregation.rb @@ -18,7 +18,7 @@ module ActiveRelation end def attributes - expressions.collect { |e| e.substitute(self) } + expressions.collect { |e| e.bind(self) } end protected diff --git a/lib/active_relation/relations/compound.rb b/lib/active_relation/relations/compound.rb index befb7f26d2..d11d09fbf6 100644 --- a/lib/active_relation/relations/compound.rb +++ b/lib/active_relation/relations/compound.rb @@ -6,7 +6,7 @@ module ActiveRelation :to => :relation def attributes - relation.attributes.collect { |a| a.substitute(self) } + relation.attributes.collect { |a| a.bind(self) } end end end
\ No newline at end of file diff --git a/lib/active_relation/relations/join.rb b/lib/active_relation/relations/join.rb index be2e89dd82..6d59ffcf39 100644 --- a/lib/active_relation/relations/join.rb +++ b/lib/active_relation/relations/join.rb @@ -24,7 +24,7 @@ module ActiveRelation [ relation1.aggregation?? relation1.attributes.collect(&:to_attribute) : relation1.attributes, relation2.aggregation?? relation2.attributes.collect(&:to_attribute) : relation2.attributes, - ].flatten.collect { |a| a.substitute(self) } + ].flatten.collect { |a| a.bind(self) } end def prefix_for(attribute) @@ -52,7 +52,7 @@ module ActiveRelation private def join - [join_sql, right_table_sql, "ON", predicates.collect { |p| p.substitute(self).to_sql(Sql::Predicate.new) }.join(' AND ')].join(" ") + [join_sql, right_table_sql, "ON", predicates.collect { |p| p.bind(self).to_sql(Sql::Predicate.new) }.join(' AND ')].join(" ") end def right_table_sql diff --git a/lib/active_relation/relations/rename.rb b/lib/active_relation/relations/rename.rb index 83ab41df70..6b1b29bf75 100644 --- a/lib/active_relation/relations/rename.rb +++ b/lib/active_relation/relations/rename.rb @@ -19,12 +19,12 @@ module ActiveRelation end def attributes - relation.attributes.collect(&method(:substitute)) + relation.attributes.collect(&method(:baptize)) end private - def substitute(attribute) - (attribute =~ self.attribute ? attribute.as(pseudonym) : attribute).substitute(self) rescue nil + def baptize(attribute) + (attribute =~ self.attribute ? attribute.as(pseudonym) : attribute).bind(self) rescue nil end end end
\ No newline at end of file |