From f4a23567e2612fc72ff3655a9169ed032610fc84 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 16 Jul 2009 13:35:07 -0300 Subject: Added ActiveRecord::Base#(where|join|project|group|order|take|skip) methods. --- activerecord/lib/active_record/associations.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 31d3a89b9d..a4228e2a2a 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1599,16 +1599,16 @@ module ActiveRecord conditions = construct_conditions(options[:conditions], scope) || '' conditions << construct_limited_ids_condition(conditions, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - arel = arel_table((scope && scope[:from]) || options[:from] || table_name). - join(joins). - where(conditions). - project(column_aliases(join_dependency)). - group(construct_group(options[:group], options[:having], scope)). - order(construct_order(options[:order], scope)) + arel_table((scope && scope[:from]) || options[:from]) + join(joins) + where(conditions) + project(column_aliases(join_dependency)) + group(construct_group(options[:group], options[:having], scope)) + order(construct_order(options[:order], scope)) - arel = arel.take(construct_limit(options, scope)) if using_limitable_reflections?(join_dependency.reflections) + take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) - return sanitize_sql(arel.to_sql) + return sanitize_sql(arel_relation.to_sql) end def construct_limited_ids_condition(where, options, join_dependency) -- cgit v1.2.3