aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-10-29 09:37:13 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-10-29 09:37:13 -0600
commit42b9f3eb5226b4c7b59a4cbc4ff0e81a420aeb45 (patch)
treef41b55a23445ef7b300b73ca9eb3da3ba6bf20e7 /activerecord/lib/active_record/inheritance.rb
parent4a2d586cfcd58c0d65dfe7e603e4e5e84418801e (diff)
downloadrails-42b9f3eb5226b4c7b59a4cbc4ff0e81a420aeb45.tar.gz
rails-42b9f3eb5226b4c7b59a4cbc4ff0e81a420aeb45.tar.bz2
rails-42b9f3eb5226b4c7b59a4cbc4ff0e81a420aeb45.zip
Fix test failures caused by #19501
The first one is quite straightforward. We want to give the proper error message in the case where a top level constant exists, but we're looking for a nested one. We just need to port over the change to use `subclass.name` into these changes. The second set of failures, which are only present in the mysql adapter tests, are stranger to me. The failure occurs because we were previously comparing `subclass.name == self.name` instead of `subclass == self`. However, I don't think that we need to support creating anonymous classes which share a table with a class that uses STI, overrides `name` to return the same name as athe class that we have no other relationship with, when not assigned to a constant so it could never be used anyway... The commits around why that exist give no context, and I think they're just poorly written tests (WTF does `test_schema` mean anyway, and why does calling `.first` on some anonymous class test it?). We'll just disable STI on that class.
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index 53a9a9b797..741229f9c0 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -181,7 +181,7 @@ module ActiveRecord
"or overwrite #{name}.inheritance_column to use another column for that information."
end
unless subclass == self || descendants.include?(subclass)
- raise SubclassNotFound, "Invalid single-table inheritance type: #{type_name} is not a subclass of #{name}"
+ raise SubclassNotFound, "Invalid single-table inheritance type: #{subclass.name} is not a subclass of #{name}"
end
subclass
end