Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
1f3b0a86
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,发现更多精彩内容 >>
提交
1f3b0a86
编写于
1月 03, 2015
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated support to define routes with `:to` option that
doesn't contain `#`
上级
4b19d5b7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
47 deletion
+10
-47
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+4
-0
actionpack/lib/action_dispatch/routing/mapper.rb
actionpack/lib/action_dispatch/routing/mapper.rb
+2
-17
actionpack/test/dispatch/routing_test.rb
actionpack/test/dispatch/routing_test.rb
+4
-30
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
1f3b0a86
*
Remove deprecated support to define routes with
`:to`
option that doesn't contain
`#`
.
*Rafael Mendonça França*
*
Remove deprecated
`ActionDispatch::Response#to_ary`
.
*Rafael Mendonça França*
...
...
actionpack/lib/action_dispatch/routing/mapper.rb
浏览文件 @
1f3b0a86
...
...
@@ -8,7 +8,6 @@
require
'active_support/inflector'
require
'action_dispatch/routing/redirection'
require
'action_dispatch/routing/endpoint'
require
'active_support/deprecation'
module
ActionDispatch
module
Routing
...
...
@@ -279,22 +278,8 @@ def check_part(name, part, path_params, hash)
end
def
split_to
(
to
)
case
to
when
Symbol
ActiveSupport
::
Deprecation
.
warn
(
<<-
MSG
.
squish
)
Defining a route where `to` is a symbol is deprecated.
Please change `to: :
#{
to
}
` to `action: :
#{
to
}
`.
MSG
[
nil
,
to
.
to_s
]
when
/#/
then
to
.
split
(
'#'
)
when
String
ActiveSupport
::
Deprecation
.
warn
(
<<-
MSG
.
squish
)
Defining a route where `to` is a controller without an action is deprecated.
Please change `to: :
#{
to
}
` to `controller: :
#{
to
}
`.
MSG
[
to
,
nil
]
if
to
=~
/#/
to
.
split
(
'#'
)
else
[]
end
...
...
actionpack/test/dispatch/routing_test.rb
浏览文件 @
1f3b0a86
...
...
@@ -3331,30 +3331,6 @@ def test_mix_string_to_action
assert_equal
'comments#index'
,
@response
.
body
end
def
test_mix_symbol_to_controller_action
assert_deprecated
do
draw
do
get
'/projects'
,
controller:
'project_files'
,
action:
'index'
,
to: :show
end
end
get
'/projects'
assert_equal
'project_files#show'
,
@response
.
body
end
def
test_mix_string_to_controller_action_no_hash
assert_deprecated
do
draw
do
get
'/projects'
,
controller:
'project_files'
,
action:
'index'
,
to:
'show'
end
end
get
'/projects'
assert_equal
'show#index'
,
@response
.
body
end
def
test_shallow_path_and_prefix_are_not_added_to_non_shallow_routes
draw
do
scope
shallow_path:
'projects'
,
shallow_prefix:
'project'
do
...
...
@@ -3629,15 +3605,13 @@ def test_missing_controller
assert_match
(
/Missing :controller/
,
ex
.
message
)
end
def
test_missing_
action
def
test_missing_
controller_with_to
ex
=
assert_raises
(
ArgumentError
)
{
assert_deprecated
do
draw
do
get
'/foo/bar'
,
:to
=>
'foo'
end
draw
do
get
'/foo/bar'
,
:to
=>
'foo'
end
}
assert_match
(
/Missing :
action
/
,
ex
.
message
)
assert_match
(
/Missing :
controller
/
,
ex
.
message
)
end
def
test_missing_action_on_hash
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录