diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-01-23 05:07:35 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-01-23 05:07:35 +0000 |
commit | bc97a871387650fc3daac6fd8f9e92cbe70168db (patch) | |
tree | a1cf2a9ed14a85af3d2869eb764f7f7b015c4351 /activerecord/lib/active_record | |
parent | 37fa17f55aceea87e6ae825e45ecb266b67e94d7 (diff) | |
download | rails-bc97a871387650fc3daac6fd8f9e92cbe70168db.tar.gz rails-bc97a871387650fc3daac6fd8f9e92cbe70168db.tar.bz2 rails-bc97a871387650fc3daac6fd8f9e92cbe70168db.zip |
Fix incorrect usage of #classify when creating the eager loading join statement. Closes #7044 [Josh Susser]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 4f251077ed..bd84bc8247 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1545,11 +1545,11 @@ module ActiveRecord " LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [ table_alias_for(options[:join_table], aliased_join_table_name), aliased_join_table_name, - options[:foreign_key] || reflection.active_record.to_s.classify.foreign_key, + options[:foreign_key] || reflection.active_record.to_s.foreign_key, parent.aliased_table_name, reflection.active_record.primary_key] + " LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [ table_name_and_alias, aliased_table_name, klass.primary_key, - aliased_join_table_name, options[:association_foreign_key] || klass.table_name.classify.foreign_key + aliased_join_table_name, options[:association_foreign_key] || klass.to_s.foreign_key ] when :has_many, :has_one case @@ -1565,7 +1565,7 @@ module ActiveRecord parent.aliased_table_name, parent.primary_key, aliased_join_table_name, polymorphic_foreign_type, klass.quote_value(parent.active_record.base_class.name)] + " LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [table_name_and_alias, - aliased_table_name, primary_key, aliased_join_table_name, options[:foreign_key] || reflection.klass.to_s.classify.foreign_key + aliased_table_name, primary_key, aliased_join_table_name, options[:foreign_key] || reflection.klass.to_s.foreign_key ] else if source_reflection.macro == :has_many && source_reflection.options[:as] @@ -1584,10 +1584,10 @@ module ActiveRecord case source_reflection.macro when :belongs_to first_key = primary_key - second_key = source_reflection.options[:foreign_key] || klass.to_s.classify.foreign_key + second_key = source_reflection.options[:foreign_key] || klass.to_s.foreign_key extra = nil when :has_many - first_key = through_reflection.klass.base_class.to_s.classify.foreign_key + first_key = through_reflection.klass.base_class.to_s.foreign_key second_key = options[:foreign_key] || primary_key extra = through_reflection.klass.descends_from_active_record? ? nil : " AND %s.%s = %s" % [ |