From 0bfc504d9ced49d50afa7a8b19680ae7f42c2b24 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Tue, 31 Jan 2012 08:41:51 +0000 Subject: Add workaround and deprecation if the inherited hook is not executed. Closes #4757. --- activerecord/test/cases/attribute_methods_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test/cases/attribute_methods_test.rb') diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 0fbe1813fb..fb53eb1a4b 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -770,6 +770,16 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert_equal "lol", topic.author_name end + def test_inherited_hook_removed + parent = Class.new(ActiveRecord::Base) + parent.table_name = "posts" + def parent.inherited(k) + end + + klass = Class.new(parent) + assert_deprecated { klass.define_attribute_methods } + end + private def cached_columns @cached_columns ||= time_related_columns_on_topic.map(&:name) -- cgit v1.2.3