aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-03-05 11:56:24 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-03-05 11:56:24 -0800
commit74818a35432b40fef16fe74f248ea75d35405324 (patch)
treeeea13e900b76fdede95fecd6507b7317eaa60371 /activerecord/lib/active_record
parent20768176292cbcb883ab152b4aa9ed8c664771cd (diff)
downloadrails-74818a35432b40fef16fe74f248ea75d35405324.tar.gz
rails-74818a35432b40fef16fe74f248ea75d35405324.tar.bz2
rails-74818a35432b40fef16fe74f248ea75d35405324.zip
use Arel::Table#alias rather than passing the :as parameter
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/base.rb4
-rw-r--r--activerecord/lib/active_record/relation/predicate_builder.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 4db08c774b..a5e1c91f47 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -636,7 +636,7 @@ module ActiveRecord #:nodoc:
@quoted_table_name = nil
define_attr_method :table_name, value, &block
- @arel_table = Arel::Table.new(table_name, :engine => arel_engine)
+ @arel_table = Arel::Table.new(table_name, arel_engine)
@relation = Relation.new(self, arel_table)
end
alias :table_name= :set_table_name
@@ -1321,7 +1321,7 @@ MSG
def sanitize_sql_hash_for_conditions(attrs, default_table_name = self.table_name)
attrs = expand_hash_conditions_for_aggregates(attrs)
- table = Arel::Table.new(self.table_name, :engine => arel_engine, :as => default_table_name)
+ table = Arel::Table.new(table_name).alias(default_table_name)
viz = Arel::Visitors.for(arel_engine)
PredicateBuilder.build_from_hash(arel_engine, attrs, table).map { |b|
viz.accept b
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb
index 9633fd3d82..982b3d7e9f 100644
--- a/activerecord/lib/active_record/relation/predicate_builder.rb
+++ b/activerecord/lib/active_record/relation/predicate_builder.rb
@@ -5,14 +5,14 @@ module ActiveRecord
table = default_table
if value.is_a?(Hash)
- table = Arel::Table.new(column, :engine => engine)
+ table = Arel::Table.new(column, engine)
build_from_hash(engine, value, table)
else
column = column.to_s
if column.include?('.')
table_name, column = column.split('.', 2)
- table = Arel::Table.new(table_name, :engine => engine)
+ table = Arel::Table.new(table_name, engine)
end
attribute = table[column.to_sym]