Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e4d5b69b
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e4d5b69b
编写于
10月 03, 2012
作者:
F
Francesco Rodriguez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename page_cache_extension option to default_static_extension
上级
2f81be17
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
11 deletion
+28
-11
actionpack/lib/action_controller/caching.rb
actionpack/lib/action_controller/caching.rb
+12
-10
actionpack/lib/action_dispatch/middleware/static.rb
actionpack/lib/action_dispatch/middleware/static.rb
+1
-1
actionpack/test/controller/caching_test.rb
actionpack/test/controller/caching_test.rb
+15
-0
未找到文件。
actionpack/lib/action_controller/caching.rb
浏览文件 @
e4d5b69b
...
...
@@ -59,16 +59,18 @@ def cache_configured?
included
do
extend
ConfigMethods
# Most Rails requests do not have an extension, such as <tt>/weblog/new</tt>.
# In these cases, the page caching mechanism will add one in order to make it
# easy for the cached files to be picked up properly by the web server. By
# default, this cache extension is <tt>.html</tt>. If you want something else,
# like <tt>.php</tt> or <tt>.shtml</tt>, just set Base.page_cache_extension.
# In cases where a request already has an extension, such as <tt>.xml</tt>
# or <tt>.rss</tt>, page caching will not add an extension. This allows it
# to work well with RESTful apps.
config_accessor
:page_cache_extension
self
.
page_cache_extension
||=
'.html'
config_accessor
:default_static_extension
self
.
default_static_extension
||=
'.html'
def
self
.
page_cache_extension
=
(
extension
)
ActiveSupport
::
Deprecation
.
deprecation_warning
(
:page_cache_extension
,
:default_static_extension
)
self
.
default_static_extension
=
extension
end
def
self
.
page_cache_extension
ActiveSupport
::
Deprecation
.
deprecation_warning
(
:page_cache_extension
,
:default_static_extension
)
default_static_extension
end
config_accessor
:perform_caching
self
.
perform_caching
=
true
if
perform_caching
.
nil?
...
...
actionpack/lib/action_dispatch/middleware/static.rb
浏览文件 @
e4d5b69b
...
...
@@ -29,7 +29,7 @@ def call(env)
def
ext
@ext
||=
begin
ext
=
::
ActionController
::
Base
.
page_cache
_extension
ext
=
::
ActionController
::
Base
.
default_static
_extension
"{,
#{
ext
}
,/index
#{
ext
}
}"
end
end
...
...
actionpack/test/controller/caching_test.rb
浏览文件 @
e4d5b69b
...
...
@@ -283,3 +283,18 @@ def test_safe_buffer
end
end
end
class
DeprecatedPageCacheExtensionTest
<
ActiveSupport
::
TestCase
def
test_page_cache_extension_binds_default_static_extension
deprecation_behavior
=
ActiveSupport
::
Deprecation
.
behavior
ActiveSupport
::
Deprecation
.
behavior
=
:silence
old_extension
=
ActionController
::
Base
.
default_static_extension
ActionController
::
Base
.
page_cache_extension
=
'.rss'
assert_equal
'.rss'
,
ActionController
::
Base
.
default_static_extension
ensure
ActiveSupport
::
Deprecation
.
behavior
=
deprecation_behavior
ActionController
::
Base
.
default_static_extension
=
old_extension
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录