Skip to content

Commit

Permalink
Fixed that Base.table_name would expect a parameter when used in has_…
Browse files Browse the repository at this point in the history
…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
dhh committed Dec 22, 2004
1 parent 3f3cbb5 commit dcc4868
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 2 additions & 0 deletions activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *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. * 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 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. bubble up even when you've dealt with local issues. Closes #231 and #340.
Expand Down
Expand Up @@ -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) 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_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 @join_table = join_table
@order = options[:order] || "t.#{@association_class.primary_key}" @order = options[:order] || "t.#{@association_class.primary_key}"


Expand Down
9 changes: 2 additions & 7 deletions activerecord/lib/active_record/base.rb
Expand Up @@ -473,13 +473,8 @@ def serialized_attributes
# class Mouse < ActiveRecord::Base # class Mouse < ActiveRecord::Base
# def self.table_name() "mice" end # def self.table_name() "mice" end
# end # end
def table_name(class_name = nil) def table_name
if class_name.nil? table_name_prefix + undecorated_table_name(class_name_of_active_record_descendant(self)) + table_name_suffix
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
end end


# Defines the primary key field -- can be overridden in subclasses. Overwritting will negate any effect of the # Defines the primary key field -- can be overridden in subclasses. Overwritting will negate any effect of the
Expand Down

0 comments on commit dcc4868

Please sign in to comment.