提交 7d11f6e4 编写于 作者: G George Claghorn 提交者: Ryuta Kamizono

Fix configuring a cache store with ActiveSupport::OrderedOptions

9845cd63 broke configuring a cache store like so:

    config.cache_store = :redis_cache_store, config_for("redis/cache")

Rails::Application#config_for returns an ActiveSupport::OrderedOptions. By default, the Array#extract_options! core extension won't extract instances of Hash subclasses. Add ActiveSupport::OrderedOptions#extractable_options? and have it return true to fix.
上级 ca5c934a
......@@ -56,6 +56,10 @@ def method_missing(name, *args)
def respond_to_missing?(name, include_private)
true
end
def extractable_options?
true
end
end
# +InheritableOptions+ provides a constructor to build an +OrderedOptions+
......
......@@ -65,4 +65,13 @@ def test_object_assigned_fragment_cache_store
assert_kind_of(ActiveSupport::Cache::FileStore, store)
assert_equal "/path/to/cache/directory", store.cache_path
end
def test_redis_cache_store_with_ordered_options
options = ActiveSupport::OrderedOptions.new
options.update namespace: "foo"
store = ActiveSupport::Cache.lookup_store :redis_cache_store, options
assert_kind_of(ActiveSupport::Cache::RedisCacheStore, store)
assert_equal "foo", store.options[:namespace]
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册