Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
4ba334c0
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,发现更多精彩内容 >>
提交
4ba334c0
编写于
3月 13, 2010
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ensure controller filters are executed before stuff starts to happen.
上级
ee4c8962
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
3 deletion
+21
-3
actionpack/lib/action_controller/base.rb
actionpack/lib/action_controller/base.rb
+6
-2
actionpack/lib/action_controller/metal/rendering.rb
actionpack/lib/action_controller/metal/rendering.rb
+1
-1
actionpack/test/controller/render_test.rb
actionpack/test/controller/render_test.rb
+14
-0
未找到文件。
actionpack/lib/action_controller/base.rb
浏览文件 @
4ba334c0
...
@@ -2,7 +2,6 @@ module ActionController
...
@@ -2,7 +2,6 @@ module ActionController
class
Base
<
Metal
class
Base
<
Metal
abstract!
abstract!
include
AbstractController
::
Callbacks
include
AbstractController
::
Layouts
include
AbstractController
::
Layouts
include
AbstractController
::
Translation
include
AbstractController
::
Translation
...
@@ -23,6 +22,7 @@ class Base < Metal
...
@@ -23,6 +22,7 @@ class Base < Metal
# Rails 2.x compatibility
# Rails 2.x compatibility
include
ActionController
::
Compatibility
include
ActionController
::
Compatibility
include
ActionController
::
ImplicitRender
include
ActionController
::
Cookies
include
ActionController
::
Cookies
include
ActionController
::
Flash
include
ActionController
::
Flash
...
@@ -36,8 +36,12 @@ class Base < Metal
...
@@ -36,8 +36,12 @@ class Base < Metal
# Add instrumentations hooks at the bottom, to ensure they instrument
# Add instrumentations hooks at the bottom, to ensure they instrument
# all the methods properly.
# all the methods properly.
include
ActionController
::
Instrumentation
include
ActionController
::
Instrumentation
include
ImplicitRender
# Before callbacks should also be executed the earliest as possible, so
# also include them at the bottom.
include
AbstractController
::
Callbacks
# The same with rescue, append it at the end to wrap as much as possible.
include
ActionController
::
Rescue
include
ActionController
::
Rescue
def
self
.
inherited
(
klass
)
def
self
.
inherited
(
klass
)
...
...
actionpack/lib/action_controller/metal/rendering.rb
浏览文件 @
4ba334c0
...
@@ -6,7 +6,7 @@ module Rendering
...
@@ -6,7 +6,7 @@ module Rendering
include
AbstractController
::
Rendering
include
AbstractController
::
Rendering
# Before processing, set the request formats in current controller formats.
# Before processing, set the request formats in current controller formats.
def
process
(
*
)
#:nodoc:
def
process
_action
(
*
)
#:nodoc:
self
.
formats
=
request
.
formats
.
map
{
|
x
|
x
.
to_sym
}
self
.
formats
=
request
.
formats
.
map
{
|
x
|
x
.
to_sym
}
super
super
end
end
...
...
actionpack/test/controller/render_test.rb
浏览文件 @
4ba334c0
...
@@ -617,6 +617,15 @@ def rescue_action(e)
...
@@ -617,6 +617,15 @@ def rescue_action(e)
raise
raise
end
end
before_filter
:only
=>
:render_with_filters
do
request
.
format
=
:xml
end
# Ensure that the before filter is executed *before* self.formats is set.
def
render_with_filters
render
:action
=>
:formatted_xml_erb
end
private
private
def
determine_layout
def
determine_layout
...
@@ -1034,6 +1043,11 @@ def test_render_with_explicit_string_template
...
@@ -1034,6 +1043,11 @@ def test_render_with_explicit_string_template
assert_equal
"<html>Hello world!</html>"
,
@response
.
body
assert_equal
"<html>Hello world!</html>"
,
@response
.
body
end
end
def
test_render_with_filters
get
:render_with_filters
assert_equal
"<test>passed formatted xml erb</test>"
,
@response
.
body
end
# :ported:
# :ported:
def
test_double_render
def
test_double_render
assert_raise
(
ActionController
::
DoubleRenderError
)
{
get
:double_render
}
assert_raise
(
ActionController
::
DoubleRenderError
)
{
get
:double_render
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录