aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorChris Salzberg <chris@dejimata.com>2017-12-15 23:48:10 +0900
committerChris Salzberg <chris@dejimata.com>2017-12-17 11:58:29 +0900
commite1ceb10fa829c5d6700f0bfbb5332e8f7967183d (patch)
tree76787547c8cdb475cd389596dc8e486612cb8aed /activerecord
parent4aee5fcbfbb1d9eff01c9a2016904ae9fe93046d (diff)
downloadrails-e1ceb10fa829c5d6700f0bfbb5332e8f7967183d.tar.gz
rails-e1ceb10fa829c5d6700f0bfbb5332e8f7967183d.tar.bz2
rails-e1ceb10fa829c5d6700f0bfbb5332e8f7967183d.zip
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).
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/model_schema.rb2
1 files changed, 1 insertions, 1 deletions
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