mirror of https://github.com/rails/rails
Merge pull request #48911 from jhbabon/fix/schema-cache-settings
Ensure schema_cache_dump settings are propagated to SchemaReflection class
This commit is contained in:
commit
22fa76c125
|
@ -132,9 +132,15 @@ To keep using the current cache store, you can turn off cache versioning entirel
|
|||
end
|
||||
end
|
||||
|
||||
initializer "active_record.use_schema_cache_dump" do
|
||||
ActiveRecord::ConnectionAdapters::SchemaReflection.use_schema_cache_dump = config.active_record.use_schema_cache_dump
|
||||
end
|
||||
|
||||
initializer "active_record.check_schema_cache_dump" do
|
||||
check_schema_cache_dump_version = config.active_record.check_schema_cache_dump_version
|
||||
|
||||
ActiveRecord::ConnectionAdapters::SchemaReflection.check_schema_cache_dump_version = check_schema_cache_dump_version
|
||||
|
||||
if config.active_record.use_schema_cache_dump && !config.active_record.lazily_load_schema_cache
|
||||
config.after_initialize do |app|
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
|
|
|
@ -406,7 +406,7 @@ module ApplicationTests
|
|||
assert_not_includes Post.instance_methods, :title
|
||||
end
|
||||
|
||||
test "does not eager load attribute methods in production when the schema cache is empty and and check_schema_cache_dump_version=false" do
|
||||
test "does not eager load attribute methods in production when the schema cache is empty and check_schema_cache_dump_version=false" do
|
||||
app_file "app/models/post.rb", <<-RUBY
|
||||
class Post < ActiveRecord::Base
|
||||
end
|
||||
|
@ -507,6 +507,47 @@ module ApplicationTests
|
|||
end
|
||||
end
|
||||
|
||||
test "propagates check_schema_cache_dump_version=true to ActiveRecord::ConnectionAdapters::SchemaReflection" do
|
||||
add_to_config <<-RUBY
|
||||
config.active_record.check_schema_cache_dump_version = true
|
||||
RUBY
|
||||
|
||||
app "development"
|
||||
|
||||
assert ActiveRecord::ConnectionAdapters::SchemaReflection.check_schema_cache_dump_version
|
||||
end
|
||||
|
||||
test "propagates check_schema_cache_dump_version=false to ActiveRecord::ConnectionAdapters::SchemaReflection" do
|
||||
add_to_config <<-RUBY
|
||||
config.active_record.check_schema_cache_dump_version = false
|
||||
RUBY
|
||||
|
||||
app "development"
|
||||
|
||||
assert_not ActiveRecord::ConnectionAdapters::SchemaReflection.check_schema_cache_dump_version
|
||||
end
|
||||
|
||||
test "propagates use_schema_cache_dump=true to ActiveRecord::ConnectionAdapters::SchemaReflection" do
|
||||
add_to_config <<-RUBY
|
||||
config.active_record.use_schema_cache_dump = true
|
||||
RUBY
|
||||
|
||||
app "development"
|
||||
|
||||
assert ActiveRecord::ConnectionAdapters::SchemaReflection.use_schema_cache_dump
|
||||
end
|
||||
|
||||
test "propagates use_schema_cache_dump=false to ActiveRecord::ConnectionAdapters::SchemaReflection" do
|
||||
add_to_config <<-RUBY
|
||||
config.active_record.use_schema_cache_dump = false
|
||||
RUBY
|
||||
|
||||
app "development"
|
||||
|
||||
assert_not ActiveRecord::ConnectionAdapters::SchemaReflection.use_schema_cache_dump
|
||||
end
|
||||
|
||||
|
||||
test "filter_parameters should be able to set via config.filter_parameters" do
|
||||
add_to_config <<-RUBY
|
||||
config.filter_parameters += [ :foo, 'bar', lambda { |key, value|
|
||||
|
|
Loading…
Reference in New Issue