提交 dcc48680 编写于 作者: D David Heinemeier Hansson

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

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
上级 3f3cbb51
*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.
......
......@@ -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}"
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册