Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactored a bit
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1202 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Apr 18, 2005
1 parent 1a6954a commit a263612
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions activerecord/lib/active_record/associations.rb
Expand Up @@ -709,7 +709,7 @@ def construct_finder_sql_with_included_associations(options, schema_abbreviation
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]
Expand All @@ -721,10 +721,6 @@ def column_aliases(schema_abbreviations)
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
Expand Down

0 comments on commit a263612

Please sign in to comment.