Skip to content
Browse files

Fixed that Base.table_name would expect a parameter when used in has_…

…and_belongs_to_many joins [Anna Lissa Cruz]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@244 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 3f3cbb5 commit dcc486805e5d79bd10fd5dfe302302522d250e86 @dhh dhh committed Dec 22, 2004
View
2 activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that Base.table_name would expect a parameter when used in has_and_belongs_to_many joins [Anna Lissa Cruz]
+
* Fixed that nested transactions now work by letting the outer most transaction have the responsibilty of starting and rolling back the transaction.
If any of the inner transactions swallow the exception raised, though, the transaction will not be rolled back. So always let the transaction
bubble up even when you've dealt with local issues. Closes #231 and #340.
View
2 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -5,7 +5,7 @@ def initialize(owner, association_name, association_class_name, association_clas
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)) + "_id"
- association_table_name = options[:table_name] || @association_class.table_name(association_class_name)
+ association_table_name = options[:table_name] || @association_class.table_name
@join_table = join_table
@order = options[:order] || "t.#{@association_class.primary_key}"
View
9 activerecord/lib/active_record/base.rb
@@ -473,13 +473,8 @@ def serialized_attributes
# class Mouse < ActiveRecord::Base
# def self.table_name() "mice" end
# end
- def table_name(class_name = nil)
- if class_name.nil?
- class_name = class_name_of_active_record_descendant(self)
- table_name_prefix + undecorated_table_name(class_name) + table_name_suffix
- else
- table_name_prefix + undecorated_table_name(class_name) + table_name_suffix
- end
+ def table_name
+ table_name_prefix + undecorated_table_name(class_name_of_active_record_descendant(self)) + table_name_suffix
end
# Defines the primary key field -- can be overridden in subclasses. Overwritting will negate any effect of the

0 comments on commit dcc4868

Please sign in to comment.
Something went wrong with that request. Please try again.