Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
d282125a
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,体验更适合开发者的 AI 搜索 >>
提交
d282125a
编写于
1月 03, 2015
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecate `*_path` helpers in email views
上级
2cc91c37
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
10 addition
and
94 deletion
+10
-94
actionmailer/CHANGELOG.md
actionmailer/CHANGELOG.md
+4
-0
actionpack/lib/action_dispatch/routing/route_set.rb
actionpack/lib/action_dispatch/routing/route_set.rb
+4
-25
actionpack/test/routing/helper_test.rb
actionpack/test/routing/helper_test.rb
+0
-14
railties/test/application/initializers/frameworks_test.rb
railties/test/application/initializers/frameworks_test.rb
+0
-1
railties/test/application/mailer_previews_test.rb
railties/test/application/mailer_previews_test.rb
+0
-52
railties/test/railties/engine_test.rb
railties/test/railties/engine_test.rb
+2
-2
未找到文件。
actionmailer/CHANGELOG.md
浏览文件 @
d282125a
*
Remove deprecate
`*_path`
helpers in email views.
*Rafael Mendonça França*
*
Remove deprecated
`deliver`
and
`deliver!`
methods.
*claudiob*
...
...
actionpack/lib/action_dispatch/routing/route_set.rb
浏览文件 @
d282125a
...
...
@@ -87,7 +87,7 @@ def merge_default_action!(params)
# named routes.
class
NamedRouteCollection
#:nodoc:
include
Enumerable
attr_reader
:routes
,
:url_helpers_module
attr_reader
:routes
,
:url_helpers_module
,
:path_helpers_module
def
initialize
@routes
=
{}
...
...
@@ -162,25 +162,6 @@ def length
routes
.
length
end
def
path_helpers_module
(
warn
=
false
)
if
warn
mod
=
@path_helpers_module
helpers
=
@path_helpers
Module
.
new
do
include
mod
helpers
.
each
do
|
meth
|
define_method
(
meth
)
do
|*
args
,
&
block
|
ActiveSupport
::
Deprecation
.
warn
(
"The method `
#{
meth
}
` cannot be used here as a full URL is required. Use `
#{
meth
.
to_s
.
sub
(
/_path$/
,
'_url'
)
}
` instead"
)
super
(
*
args
,
&
block
)
end
end
end
else
@path_helpers_module
end
end
class
UrlHelper
# :nodoc:
def
self
.
create
(
route
,
options
,
route_name
,
url_strategy
)
if
optimize_helper?
(
route
)
...
...
@@ -500,12 +481,10 @@ def url_options; {}; end
if
supports_path
path_helpers
=
routes
.
named_routes
.
path_helpers_module
else
path_helpers
=
routes
.
named_routes
.
path_helpers_module
(
true
)
end
include
path_helpers
extend
path_helpers
include
path_helpers
extend
path_helpers
end
# plus a singleton class method called _routes ...
included
do
...
...
actionpack/test/routing/helper_test.rb
浏览文件 @
d282125a
...
...
@@ -26,20 +26,6 @@ def test_exception
x
.
new
.
pond_duck_path
Duck
.
new
end
end
def
test_path_deprecation
rs
=
::
ActionDispatch
::
Routing
::
RouteSet
.
new
rs
.
draw
do
resources
:ducks
end
x
=
Class
.
new
{
include
rs
.
url_helpers
(
false
)
}
assert_deprecated
do
assert_equal
'/ducks'
,
x
.
new
.
ducks_path
end
end
end
end
end
railties/test/application/initializers/frameworks_test.rb
浏览文件 @
d282125a
...
...
@@ -65,7 +65,6 @@ def notify
RUBY
require
"
#{
app_path
}
/config/environment"
assert
Foo
.
method_defined?
(
:foo_path
)
assert
Foo
.
method_defined?
(
:foo_url
)
assert
Foo
.
method_defined?
(
:main_app
)
end
...
...
railties/test/application/mailer_previews_test.rb
浏览文件 @
d282125a
...
...
@@ -428,58 +428,6 @@ def foo
assert_match
'<option selected value="?part=text%2Fplain">View as plain-text email</option>'
,
last_response
.
body
end
test
"*_path helpers emit a deprecation"
do
app_file
"config/routes.rb"
,
<<-
RUBY
Rails.application.routes.draw do
get 'foo', to: 'foo#index'
end
RUBY
mailer
'notifier'
,
<<-
RUBY
class Notifier < ActionMailer::Base
default from: "from@example.com"
def path_in_view
mail to: "to@example.org"
end
def path_in_mailer
@url = foo_path
mail to: "to@example.org"
end
end
RUBY
html_template
'notifier/path_in_view'
,
"<%= link_to 'foo', foo_path %>"
mailer_preview
'notifier'
,
<<-
RUBY
class NotifierPreview < ActionMailer::Preview
def path_in_view
Notifier.path_in_view
end
def path_in_mailer
Notifier.path_in_mailer
end
end
RUBY
app
(
'development'
)
assert_deprecated
do
get
"/rails/mailers/notifier/path_in_view.html"
assert_equal
200
,
last_response
.
status
end
html_template
'notifier/path_in_mailer'
,
"No ERB in here"
assert_deprecated
do
get
"/rails/mailers/notifier/path_in_mailer.html"
assert_equal
200
,
last_response
.
status
end
end
private
def
build_app
super
...
...
railties/test/railties/engine_test.rb
浏览文件 @
d282125a
...
...
@@ -741,8 +741,8 @@ class MyMailer < ActionMailer::Base
assert_equal
"bukkits_"
,
Bukkits
.
table_name_prefix
assert_equal
"bukkits"
,
Bukkits
::
Engine
.
engine_name
assert_equal
Bukkits
.
railtie_namespace
,
Bukkits
::
Engine
assert
::
Bukkits
::
MyMailer
.
method_defined?
(
:foo_
path
)
assert
!::
Bukkits
::
MyMailer
.
method_defined?
(
:bar_
path
)
assert
::
Bukkits
::
MyMailer
.
method_defined?
(
:foo_
url
)
assert
!::
Bukkits
::
MyMailer
.
method_defined?
(
:bar_
url
)
get
(
"/bukkits/from_app"
)
assert_equal
"false"
,
last_response
.
body
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录