From e8d1d84837a59ef7d73b29b16ee05cd610d30a90 Mon Sep 17 00:00:00 2001 From: Ujjwal Thaakar Date: Tue, 14 Jan 2014 18:53:45 +0530 Subject: Don't try to get the subclass if the inheritance column doesn't exist The `subclass_from_attrs` method is called even if the column specified by the `inheritance_column` setting doesn't exist. This prevents setting associations via the attributes hash if the association name clashes with the value of the setting, typically `:type`. This worked previously in Rails 3.2. --- activerecord/test/schema/schema.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test/schema/schema.rb') diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index ddfc1ac0d6..9a7d918a25 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -557,9 +557,14 @@ ActiveRecord::Schema.define do create_table :products, force: true do |t| t.references :collection + t.references :type t.string :name end + create_table :product_types, force: true do |t| + t.string :name + end + create_table :projects, force: true do |t| t.string :name t.string :type -- cgit v1.2.3