From e1ceb10fa829c5d6700f0bfbb5332e8f7967183d Mon Sep 17 00:00:00 2001 From: Chris Salzberg Date: Fri, 15 Dec 2017 23:48:10 +0900 Subject: Undefine attribute methods on all descendants when resetting column info If we don't do this, then we end up with an inconsistent situation where a parent class may e.g. reset column information, but child classes will contine to see attribute methods as already generated, and thus not pick up this new column (falling through to method_missing). --- activerecord/lib/active_record/model_schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 773b0f6cde..fa7537c1a3 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -425,7 +425,7 @@ module ActiveRecord # end def reset_column_information connection.clear_cache! - undefine_attribute_methods + ([self] + descendants).each(&:undefine_attribute_methods) connection.schema_cache.clear_data_source_cache!(table_name) reload_schema_from_cache -- cgit v1.2.3