aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-02-28 03:07:56 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-03-04 02:34:00 +0900
commitd35875b7a3f559155a9378cbe9203b0b8ea580f9 (patch)
treee8d8c225cf2309976327a94370f09f901023a9b1 /activerecord/lib/active_record/inheritance.rb
parent75a24602edacd3e66b5c38c2b5efe885dfdd14ab (diff)
downloadrails-d35875b7a3f559155a9378cbe9203b0b8ea580f9.tar.gz
rails-d35875b7a3f559155a9378cbe9203b0b8ea580f9.tar.bz2
rails-d35875b7a3f559155a9378cbe9203b0b8ea580f9.zip
Extract all `base_class.name` as `polymorphic_name`
This is an alternative of #29722, and follow up of #32048. This does not change the current behavior, but makes it easier to modify all polymorphic names consistently.
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index 77cfb36b25..208ba95c52 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -156,6 +156,10 @@ module ActiveRecord
store_full_sti_class ? name : name.demodulize
end
+ def polymorphic_name
+ base_class.name
+ end
+
def inherited(subclass)
subclass.instance_variable_set(:@_type_candidates_cache, Concurrent::Map.new)
super