diff options
author | Matthew Draper <matthew@trebex.net> | 2017-06-05 03:28:12 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-06-05 03:28:12 +0930 |
commit | e95d2a0f2f51298aebc5201551860fe8e7f8ece6 (patch) | |
tree | bf28eff49fe03e725f904ba56204b67dc582dc2b /activerecord | |
parent | 704209b017277f3404dacded2b0bb5c6d81aeb6d (diff) | |
download | rails-e95d2a0f2f51298aebc5201551860fe8e7f8ece6.tar.gz rails-e95d2a0f2f51298aebc5201551860fe8e7f8ece6.tar.bz2 rails-e95d2a0f2f51298aebc5201551860fe8e7f8ece6.zip |
Don't mark the schema loaded until it's really finished
load_schema! is overridden by attribute modules, so we need to wait
until it has returned.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/model_schema.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 1179a60e9b..14e0f5bff7 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -446,7 +446,11 @@ module ActiveRecord def load_schema return if schema_loaded? @load_schema_monitor.synchronize do - load_schema! unless defined?(@columns_hash) && @columns_hash + return if defined?(@columns_hash) && @columns_hash + + load_schema! + + @schema_loaded = true end end @@ -460,8 +464,6 @@ module ActiveRecord user_provided_default: false ) end - - @schema_loaded = true end def reload_schema_from_cache |