提交 3cd4c7c0 编写于 作者: R Ryuta Kamizono

Suppress deprecation message to `has_and_belongs_to_many` only once

Passing a class to `has_and_belongs_to_many` show deprecation message
three times. It is enough only once.
上级 3bc747bd
......@@ -1827,7 +1827,7 @@ def has_and_belongs_to_many(name, scope = nil, **options, &extension)
builder = Builder::HasAndBelongsToMany.new name, self, options
join_model = builder.through_model
join_model = ActiveSupport::Deprecation.silence { builder.through_model }
const_set join_model.name, join_model
private_constant join_model.name
......@@ -1856,7 +1856,7 @@ def destroy_associations
hm_options[k] = options[k] if options.key? k
end
has_many name, scope, hm_options, &extension
ActiveSupport::Deprecation.silence { has_many name, scope, hm_options, &extension }
_reflections[name.to_s].parent_reflection = habtm_reflection
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册