From 20574956d1ca73b5713bb857870fcd57cd09b35e Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sun, 2 Sep 2012 17:19:50 +0200 Subject: set the configured #inheritance_column on #become (#7503) I had to create a new table because I needed an STI table, which does not have both a "type" and a "custom_type" the test fails with: 1) Error: test_alt_becomes_works_with_sti(InheritanceTest): NoMethodError: undefined method `type=' for # /Users/username/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:432:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:100:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/persistence.rb:165:in `becomes' test/cases/inheritance_test.rb:134:in `test_becomes_works_with_sti' test/cases/inheritance_test.rb:140:in `test_alt_becomes_works_with_sti' --- activerecord/test/models/vegetables.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 activerecord/test/models/vegetables.rb (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/vegetables.rb b/activerecord/test/models/vegetables.rb new file mode 100644 index 0000000000..59cedfd9f5 --- /dev/null +++ b/activerecord/test/models/vegetables.rb @@ -0,0 +1,14 @@ +class Vegetable < ActiveRecord::Base + + validates_presence_of :name + + def self.inheritance_column + 'custom_type' + end +end + +class Cucumber < Vegetable +end + +class Cabbage < Vegetable +end -- cgit v1.2.3