Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
333bfd89
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,发现更多精彩内容 >>
未验证
提交
333bfd89
编写于
5月 10, 2016
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated support to `:back` in `redirect_to`
上级
a2762d95
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
50 deletion
+4
-50
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+4
-0
actionpack/lib/action_controller/metal/redirecting.rb
actionpack/lib/action_controller/metal/redirecting.rb
+0
-8
actionpack/test/controller/redirect_test.rb
actionpack/test/controller/redirect_test.rb
+0
-42
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
333bfd89
*
Remove deprecated support to
`:back`
in
`redirect_to`
.
*Rafael Mendonça França*
*
Remove deprecated support to passing status as option
`head`
.
*Rafael Mendonça França*
...
...
actionpack/lib/action_controller/metal/redirecting.rb
浏览文件 @
333bfd89
...
...
@@ -104,14 +104,6 @@ def _compute_redirect_to_location(request, options) #:nodoc:
options
when
String
request
.
protocol
+
request
.
host_with_port
+
options
when
:back
ActiveSupport
::
Deprecation
.
warn
(
<<-
MESSAGE
.
squish
)
`redirect_to :back` is deprecated and will be removed from Rails 5.1.
Please use `redirect_back(fallback_location: fallback_location)` where
`fallback_location` represents the location to use if the request has
no HTTP referer information.
MESSAGE
request
.
headers
[
"Referer"
]
||
raise
(
RedirectBackError
)
when
Proc
_compute_redirect_to_location
request
,
options
.
call
else
...
...
actionpack/test/controller/redirect_test.rb
浏览文件 @
333bfd89
...
...
@@ -56,10 +56,6 @@ def relative_url_redirect_with_status_hash
redirect_to
(
"/things/stuff"
,
status:
301
)
end
def
redirect_to_back_with_status
redirect_to
:back
,
status:
307
end
def
redirect_back_with_status
redirect_back
(
fallback_location:
"/things/stuff"
,
status:
307
)
end
...
...
@@ -88,10 +84,6 @@ def redirect_to_url_with_network_path_reference
redirect_to
"//www.rubyonrails.org/"
end
def
redirect_to_back
redirect_to
:back
end
def
redirect_to_existing_record
redirect_to
Workshop
.
new
(
5
)
end
...
...
@@ -206,17 +198,6 @@ def test_relative_url_redirect_with_status_hash
assert_equal
"http://test.host/things/stuff"
,
redirect_to_url
end
def
test_redirect_to_back_with_status
@request
.
env
[
"HTTP_REFERER"
]
=
"http://www.example.com/coming/from"
assert_deprecated
do
get
:redirect_to_back_with_status
end
assert_response
307
assert_equal
"http://www.example.com/coming/from"
,
redirect_to_url
end
def
test_simple_redirect_using_options
get
:host_redirect
assert_response
:redirect
...
...
@@ -259,29 +240,6 @@ def test_redirect_to_url_with_network_path_reference
assert_equal
"//www.rubyonrails.org/"
,
redirect_to_url
end
def
test_redirect_to_back
@request
.
env
[
"HTTP_REFERER"
]
=
"http://www.example.com/coming/from"
assert_deprecated
do
get
:redirect_to_back
end
assert_response
:redirect
assert_equal
"http://www.example.com/coming/from"
,
redirect_to_url
end
def
test_redirect_to_back_with_no_referer
assert_raise
(
ActionController
::
RedirectBackError
)
{
@request
.
env
[
"HTTP_REFERER"
]
=
nil
assert_deprecated
do
get
:redirect_to_back
end
get
:redirect_to_back
}
end
def
test_redirect_back
referer
=
"http://www.example.com/coming/from"
@request
.
env
[
"HTTP_REFERER"
]
=
referer
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录