diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index f3e2189bcb5ae528fef6d00cd3310007a1a85c44..4606c91ffd344af0b6ccef291aecada10825aab6 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -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 diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 2da85df9e9d447522aa11a9838939c5b30b3f9d2..8af0d06ecb1f25f0c56c47be43b03457a3d3b71d 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -372,7 +372,7 @@ def initialize(name, scope, options, active_record) necessary and potentially creates circular dependencies. Please pass the class name as a string: - `belongs_to :client, class_name: 'Company'` + `#{macro} :#{name}, class_name: '#{options[:class_name]}'` MSG end end