Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
341f9a07
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,发现更多精彩内容 >>
提交
341f9a07
编写于
3月 18, 2013
作者:
A
Andrew White
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9774 from senny/9772_reraise_no_method_error_in_proper_context
`TimeWithZone` raises `NoMethodError` in proper context.
上级
eb32b365
836ea9fb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
0 deletion
+15
-0
activesupport/CHANGELOG.md
activesupport/CHANGELOG.md
+5
-0
activesupport/lib/active_support/time_with_zone.rb
activesupport/lib/active_support/time_with_zone.rb
+2
-0
activesupport/test/core_ext/time_with_zone_test.rb
activesupport/test/core_ext/time_with_zone_test.rb
+8
-0
未找到文件。
activesupport/CHANGELOG.md
浏览文件 @
341f9a07
## Rails 4.0.0 (unreleased) ##
## Rails 4.0.0 (unreleased) ##
*
`ActiveSupport::TimeWithZone`
raises
`NoMethodError`
in proper context.
Fixes #9772.
*Yves Senn*
*
Fix deletion of empty directories in
`ActiveSupport::Cache::FileStore`
.
*
Fix deletion of empty directories in
`ActiveSupport::Cache::FileStore`
.
*Charles Jones*
*Charles Jones*
...
...
activesupport/lib/active_support/time_with_zone.rb
浏览文件 @
341f9a07
...
@@ -366,6 +366,8 @@ def respond_to_missing?(sym, include_priv)
...
@@ -366,6 +366,8 @@ def respond_to_missing?(sym, include_priv)
# TimeWithZone with the existing +time_zone+.
# TimeWithZone with the existing +time_zone+.
def
method_missing
(
sym
,
*
args
,
&
block
)
def
method_missing
(
sym
,
*
args
,
&
block
)
wrap_with_time_zone
time
.
__send__
(
sym
,
*
args
,
&
block
)
wrap_with_time_zone
time
.
__send__
(
sym
,
*
args
,
&
block
)
rescue
NoMethodError
=>
e
raise
e
,
e
.
message
.
sub
(
time
.
inspect
,
self
.
inspect
),
e
.
backtrace
end
end
private
private
...
...
activesupport/test/core_ext/time_with_zone_test.rb
浏览文件 @
341f9a07
...
@@ -779,6 +779,14 @@ def test_advance_1_year_during_dst
...
@@ -779,6 +779,14 @@ def test_advance_1_year_during_dst
assert_equal
"Sun, 15 Jul 2007 10:30:00 EDT -04:00"
,
(
twz
-
1
.
year
).
inspect
assert_equal
"Sun, 15 Jul 2007 10:30:00 EDT -04:00"
,
(
twz
-
1
.
year
).
inspect
end
end
def
test_no_method_error_has_proper_context
e
=
assert_raises
(
NoMethodError
)
{
@twz
.
this_method_does_not_exist
}
assert_equal
"undefined method `this_method_does_not_exist' for Fri, 31 Dec 1999 19:00:00 EST -05:00:Time"
,
e
.
message
assert_no_match
"rescue"
,
e
.
backtrace
.
first
end
protected
protected
def
with_env_tz
(
new_tz
=
'US/Eastern'
)
def
with_env_tz
(
new_tz
=
'US/Eastern'
)
old_tz
,
ENV
[
'TZ'
]
=
ENV
[
'TZ'
],
new_tz
old_tz
,
ENV
[
'TZ'
]
=
ENV
[
'TZ'
],
new_tz
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录