Fixed has_and_belongs_to_many guessing of foreign key so that keys are generated correctly for models like SomeVerySpecialClient [Florian Weber]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@69 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2004-12-07 12:33:42 +00:00
parent ea759cb761
commit 8a40c6b522
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,8 @@
*CVS* *CVS*
* Fixed has_and_belongs_to_many guessing of foreign key so that keys are generated correctly for models like SomeVerySpecialClient
[Florian Weber]
* Added counter_sql option for has_many associations [bitsweat]. Documentation: * Added counter_sql option for has_many associations [bitsweat]. Documentation:
<tt>:counter_sql</tt> - specify a complete SQL statement to fetch the size of the association. If +:finder_sql+ is <tt>:counter_sql</tt> - specify a complete SQL statement to fetch the size of the association. If +:finder_sql+ is

View File

@ -4,7 +4,7 @@ module ActiveRecord
def initialize(owner, association_name, association_class_name, association_class_primary_key_name, join_table, options) def initialize(owner, association_name, association_class_name, association_class_primary_key_name, join_table, options)
super(owner, association_name, association_class_name, association_class_primary_key_name, options) super(owner, association_name, association_class_name, association_class_primary_key_name, options)
@association_foreign_key = options[:association_foreign_key] || Inflector.underscore(Inflector.demodulize(association_class_name.downcase)) + "_id" @association_foreign_key = options[:association_foreign_key] || Inflector.underscore(Inflector.demodulize(association_class_name)) + "_id"
association_table_name = options[:table_name] || @association_class.table_name(association_class_name) association_table_name = options[:table_name] || @association_class.table_name(association_class_name)
@join_table = join_table @join_table = join_table
@order = options[:order] || "t.#{@owner.class.primary_key}" @order = options[:order] || "t.#{@owner.class.primary_key}"