diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-13 10:44:34 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-13 10:53:19 -0800 |
commit | bd51790895fc75a3b4e19e8dd7aa6dc389d77068 (patch) | |
tree | ef3ccd2dcfd84f618116b99bc2ede21b69b2ccf5 /activerecord/lib/active_record/calculations.rb | |
parent | 0da71980cd61aa6297749d0ea8520785c9a5280f (diff) | |
download | rails-bd51790895fc75a3b4e19e8dd7aa6dc389d77068.tar.gz rails-bd51790895fc75a3b4e19e8dd7aa6dc389d77068.tar.bz2 rails-bd51790895fc75a3b4e19e8dd7aa6dc389d77068.zip |
Split arel_table into method to get a relation and another to memoize the default relation.
Diffstat (limited to 'activerecord/lib/active_record/calculations.rb')
-rw-r--r-- | activerecord/lib/active_record/calculations.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 40242333e5..46545d96a3 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -146,7 +146,7 @@ module ActiveRecord join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, construct_join(options[:joins], scope)) construct_finder_arel_with_included_associations(options, join_dependency) else - relation = arel_table(options[:from]). + relation = arel_table_for(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). order(options[:order]). @@ -164,7 +164,7 @@ module ActiveRecord def execute_simple_calculation(operation, column_name, options, relation) #:nodoc: column = if column_names.include?(column_name.to_s) - Arel::Attribute.new(arel_table(options[:from] || table_name), + Arel::Attribute.new(arel_table_for(options[:from] || table_name), options[:select] || column_name) else Arel::SqlLiteral.new(options[:select] || |