aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-27 17:22:40 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-27 17:22:40 -0700
commit3aaac5b646ecd73a2fc684896402b1456e5238d8 (patch)
treeedfc10f176f9127443489e42d18e7cfebb1d9324 /lib
parent1a1e5c144b3192c552b6398607622c3d10e417ca (diff)
downloadrails-3aaac5b646ecd73a2fc684896402b1456e5238d8.tar.gz
rails-3aaac5b646ecd73a2fc684896402b1456e5238d8.tar.bz2
rails-3aaac5b646ecd73a2fc684896402b1456e5238d8.zip
PERF: fewer objects
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/algebra/relations/relation.rb9
-rw-r--r--lib/arel/engines/sql/christener.rb2
-rw-r--r--lib/arel/engines/sql/relations/table.rb5
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb
index b3dccaf8be..af97aa8344 100644
--- a/lib/arel/algebra/relations/relation.rb
+++ b/lib/arel/algebra/relations/relation.rb
@@ -71,7 +71,14 @@ module Arel
end
def where_clauses
- wheres.collect { |w| w.to_sql(Sql::WhereClause.new(self)) }
+ wheres.collect { |w|
+ case w
+ when Value
+ w.value
+ else # FIXME: why do we have to pass in a whereclause?
+ w.to_sql(Sql::WhereClause.new(self))
+ end
+ }
end
def group_clauses
diff --git a/lib/arel/engines/sql/christener.rb b/lib/arel/engines/sql/christener.rb
index 2c96020554..6160f244f7 100644
--- a/lib/arel/engines/sql/christener.rb
+++ b/lib/arel/engines/sql/christener.rb
@@ -5,7 +5,7 @@ module Arel
# FIXME: this exists because all objects hash the same. :'(
@used_names = Hash.new(0)
@relation_names = Hash.new do |hash, relation|
- name = relation.table_alias ? relation.table_alias : relation.name
+ name = relation.table_alias || relation.name
@used_names[name] += 1
hash[relation] = name + (@used_names[name] > 1 ? "_#{@used_names[name]}" : '')
end
diff --git a/lib/arel/engines/sql/relations/table.rb b/lib/arel/engines/sql/relations/table.rb
index 236a36c7a7..9e64e8e590 100644
--- a/lib/arel/engines/sql/relations/table.rb
+++ b/lib/arel/engines/sql/relations/table.rb
@@ -94,8 +94,9 @@ module Arel
end
def ==(other)
- Table === other and
- name == other.name and
+ super ||
+ Table === other &&
+ name == other.name &&
table_alias == other.table_alias
end
end