aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-12-02 17:02:11 +0100
committerYves Senn <yves.senn@gmail.com>2015-12-02 17:14:45 +0100
commit72b92e817281ddc74e587295fcaa5422cdca01f8 (patch)
tree058633bbc19c62ce6008afb2a13ed65757974ba8 /activerecord/lib/active_record/inheritance.rb
parent4294a7eebf52759be61ed57908436d6324f26120 (diff)
downloadrails-72b92e817281ddc74e587295fcaa5422cdca01f8.tar.gz
rails-72b92e817281ddc74e587295fcaa5422cdca01f8.tar.bz2
rails-72b92e817281ddc74e587295fcaa5422cdca01f8.zip
don't rely on the columns hash to get defaults. follow-up to #17169.
This will also get the defaults from attribute definitions like: attribute :type, :string, default: "SomethingElse"
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index a46afed7f4..e094735799 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -52,7 +52,7 @@ module ActiveRecord
attrs = args.first
if has_attribute?(inheritance_column)
- subclass = subclass_from_attributes(attrs) || subclass_from_defaults
+ subclass = subclass_from_attributes(attrs) || subclass_from_attributes(column_defaults)
end
if subclass && subclass != self
@@ -207,12 +207,6 @@ module ActiveRecord
end
end
end
-
- def subclass_from_defaults
- if default = columns_hash[inheritance_column].default
- find_sti_class(default)
- end
- end
end
def initialize_dup(other)