diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 07:02:12 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 07:02:12 +0000 |
commit | a263612b7e75064ffc6c9028b495b8db74aaaa1d (patch) | |
tree | 6d5eaada02620b80449505a17a9c837499632dd6 /activerecord | |
parent | 1a6954af01680d18135ce9a50ff273fd81dc6245 (diff) | |
download | rails-a263612b7e75064ffc6c9028b495b8db74aaaa1d.tar.gz rails-a263612b7e75064ffc6c9028b495b8db74aaaa1d.tar.bz2 rails-a263612b7e75064ffc6c9028b495b8db74aaaa1d.zip |
Refactored a bit
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1202 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index fffd695294..9c753f0514 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -709,7 +709,7 @@ module ActiveRecord habtm_associations = reflections.find_all { |r| r.macro == :has_and_belongs_to_many } sql = "SELECT #{column_aliases(schema_abbreviations)} FROM #{table_name} " - add_association_joins!(reflections, sql) + sql << reflections.collect { |reflection| association_join(reflection) }.to_s sql << "#{options[:joins]} " if options[:joins] add_conditions!(sql, options[:conditions]) sql << "ORDER BY #{options[:order]} " if options[:order] @@ -721,10 +721,6 @@ module ActiveRecord schema_abbreviations.collect { |cn, tc| "#{tc.join(".")} AS #{cn}" }.join(", ") end - def add_association_joins!(reflections, sql) - reflections.each { |reflection| sql << association_join(reflection) } - end - def association_join(reflection) case reflection.macro when :has_and_belongs_to_many |