Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
8f0d332a
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,发现更多精彩内容 >>
提交
8f0d332a
编写于
9月 17, 2012
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7660 from senny/7646_wrong_status_code_on_not_found
log 404 status when ActiveRecord::RecordNotFound was raised (#7646)
上级
3c48b32f
dadfa9ab
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
8 deletion
+32
-8
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+10
-6
actionpack/lib/action_controller/log_subscriber.rb
actionpack/lib/action_controller/log_subscriber.rb
+2
-1
actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
...npack/lib/action_dispatch/middleware/exception_wrapper.rb
+5
-1
actionpack/test/controller/log_subscriber_test.rb
actionpack/test/controller/log_subscriber_test.rb
+15
-0
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
8f0d332a
## Rails 4.0.0 (unreleased) ##
*
Fix #7646, the log now displays the correct status code when an exception is raised.
*Yves Senn*
*
Allow pass couple extensions to ActionView::Template.register_template_handler call.
*Tima Maslyuchenko*
*
Sprockets integration has been extracted from Action Pack and the
`sprockets-rails`
*
Sprockets integration has been extracted from Action Pack and the
`sprockets-rails`
gem should be added to Gemfile (under the assets group) in order to use Rails asset
pipeline in future versions of Rails.
pipeline in future versions of Rails.
*Guillermo Iguaran*
*
`ActionDispatch::Session::MemCacheStore`
now uses
`dalli`
instead of the deprecated
`memcache-client`
gem. As side effect the autoloading of unloaded classes objects
saved as values in session isn't supported anymore when mem_cache session store is
used, this can have an impact in apps only when config.cache_classes is false.
*
`ActionDispatch::Session::MemCacheStore`
now uses
`dalli`
instead of the deprecated
`memcache-client`
gem. As side effect the autoloading of unloaded classes objects
saved as values in session isn't supported anymore when mem_cache session store is
used, this can have an impact in apps only when config.cache_classes is false.
*Arun Agrawal + Guillermo Iguaran*
...
...
actionpack/lib/action_controller/log_subscriber.rb
浏览文件 @
8f0d332a
...
...
@@ -19,7 +19,8 @@ def process_action(event)
status
=
payload
[
:status
]
if
status
.
nil?
&&
payload
[
:exception
].
present?
status
=
ActionDispatch
::
ExceptionWrapper
.
new
({},
payload
[
:exception
]).
status_code
exception_class_name
=
payload
[
:exception
].
first
status
=
ActionDispatch
::
ExceptionWrapper
.
status_code_for_exception
(
exception_class_name
)
end
message
=
"Completed
#{
status
}
#{
Rack
::
Utils
::
HTTP_STATUS_CODES
[
status
]
}
in %.0fms"
%
event
.
duration
message
<<
" (
#{
additions
.
join
(
" | "
)
}
)"
unless
additions
.
blank?
...
...
actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
浏览文件 @
8f0d332a
...
...
@@ -37,7 +37,7 @@ def rescue_template
end
def
status_code
Rack
::
Utils
.
status_code
(
@@rescue_responses
[
@exception
.
class
.
name
]
)
self
.
class
.
status_code_for_exception
(
@exception
.
class
.
name
)
end
def
application_trace
...
...
@@ -52,6 +52,10 @@ def full_trace
clean_backtrace
(
:all
)
end
def
self
.
status_code_for_exception
(
class_name
)
Rack
::
Utils
.
status_code
(
@@rescue_responses
[
class_name
])
end
private
def
original_exception
(
exception
)
...
...
actionpack/test/controller/log_subscriber_test.rb
浏览文件 @
8f0d332a
...
...
@@ -54,6 +54,10 @@ def with_exception
def
with_rescued_exception
raise
SpecialException
end
def
with_action_not_found
raise
AbstractController
::
ActionNotFound
end
end
end
...
...
@@ -225,6 +229,17 @@ def test_process_action_with_rescued_exception_includes_http_status_code
assert_match
(
/Completed 406/
,
logs
.
last
)
end
def
test_process_action_with_with_action_not_found_logs_404
begin
get
:with_action_not_found
wait
rescue
AbstractController
::
ActionNotFound
end
assert_equal
2
,
logs
.
size
assert_match
(
/Completed 404/
,
logs
.
last
)
end
def
logs
@logs
||=
@logger
.
logged
(
:info
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录