aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-01-10 05:00:53 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-01-10 05:00:53 +0900
commit3cd4c7c0ffc3e00004a238304e903a140fcbcd67 (patch)
tree606a6c92e9430b49ceb7adf134fa1aa3b3901791 /activerecord
parent3bc747bd8676dc940b531067e2861dcd4ac28efc (diff)
downloadrails-3cd4c7c0ffc3e00004a238304e903a140fcbcd67.tar.gz
rails-3cd4c7c0ffc3e00004a238304e903a140fcbcd67.tar.bz2
rails-3cd4c7c0ffc3e00004a238304e903a140fcbcd67.zip
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.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index f3e2189bcb..4606c91ffd 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1827,7 +1827,7 @@ module ActiveRecord
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 @@ module ActiveRecord
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