1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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).
This commit is contained in:
Chris Salzberg 2017-12-15 23:48:10 +09:00
parent 4aee5fcbfb
commit e1ceb10fa8
No known key found for this signature in database
GPG key ID: 3F77FCF15E284672

View file

@ -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