Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
98f77e08
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
98f77e08
编写于
2月 26, 2010
作者:
C
Carlhuda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename named_url_helpers to url_helpers and url_helpers to url_for
上级
f10a0194
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
28 addition
and
29 deletion
+28
-29
actionmailer/lib/action_mailer/railtie.rb
actionmailer/lib/action_mailer/railtie.rb
+1
-1
actionmailer/test/old_base/url_test.rb
actionmailer/test/old_base/url_test.rb
+1
-1
actionpack/lib/action_controller/metal/url_for.rb
actionpack/lib/action_controller/metal/url_for.rb
+1
-1
actionpack/lib/action_controller/railties/url_helpers.rb
actionpack/lib/action_controller/railties/url_helpers.rb
+1
-1
actionpack/lib/action_dispatch/routing/route_set.rb
actionpack/lib/action_dispatch/routing/route_set.rb
+5
-6
actionpack/lib/action_dispatch/testing/assertions/routing.rb
actionpack/lib/action_dispatch/testing/assertions/routing.rb
+3
-3
actionpack/test/abstract_unit.rb
actionpack/test/abstract_unit.rb
+1
-1
actionpack/test/activerecord/polymorphic_routes_test.rb
actionpack/test/activerecord/polymorphic_routes_test.rb
+3
-3
actionpack/test/controller/caching_test.rb
actionpack/test/controller/caching_test.rb
+1
-1
actionpack/test/controller/integration_test.rb
actionpack/test/controller/integration_test.rb
+4
-4
actionpack/test/controller/resources_test.rb
actionpack/test/controller/resources_test.rb
+2
-2
actionpack/test/controller/routing_test.rb
actionpack/test/controller/routing_test.rb
+2
-2
actionpack/test/dispatch/routing_test.rb
actionpack/test/dispatch/routing_test.rb
+1
-1
railties/lib/rails/test_help.rb
railties/lib/rails/test_help.rb
+1
-1
railties/test/rails_info_controller_test.rb
railties/test/rails_info_controller_test.rb
+1
-1
未找到文件。
actionmailer/lib/action_mailer/railtie.rb
浏览文件 @
98f77e08
...
...
@@ -6,7 +6,7 @@ class Railtie < Rails::Railtie
railtie_name
:action_mailer
initializer
"action_mailer.url_for"
,
:before
=>
:load_environment_config
do
|
app
|
ActionMailer
::
Base
.
send
(
:include
,
app
.
routes
.
named_
url_helpers
)
ActionMailer
::
Base
.
send
(
:include
,
app
.
routes
.
url_helpers
)
end
require
"action_mailer/railties/log_subscriber"
...
...
actionmailer/test/old_base/url_test.rb
浏览文件 @
98f77e08
...
...
@@ -7,7 +7,7 @@ class WelcomeController < ActionController::Base
AppRoutes
=
ActionDispatch
::
Routing
::
RouteSet
.
new
class
ActionMailer::Base
include
AppRoutes
.
named_
url_helpers
include
AppRoutes
.
url_helpers
end
class
TestMailer
<
ActionMailer
::
Base
...
...
actionpack/lib/action_controller/metal/url_for.rb
浏览文件 @
98f77e08
...
...
@@ -15,7 +15,7 @@ def merge_options(options)
def
_router
raise
"In order to use #url_for, you must include the helpers of a particular "
\
"router. For instance, `include Rails.application.route
r.named_
url_helpers"
"router. For instance, `include Rails.application.route
s.
url_helpers"
end
end
end
\ No newline at end of file
actionpack/lib/action_controller/railties/url_helpers.rb
浏览文件 @
98f77e08
...
...
@@ -5,7 +5,7 @@ def self.with(router)
Module
.
new
do
define_method
(
:inherited
)
do
|
klass
|
super
(
klass
)
klass
.
send
(
:include
,
router
.
named_
url_helpers
)
klass
.
send
(
:include
,
router
.
url_helpers
)
end
end
end
...
...
actionpack/lib/action_dispatch/routing/route_set.rb
浏览文件 @
98f77e08
...
...
@@ -259,9 +259,8 @@ def install_helpers(destinations = [ActionController::Base, ActionView::Base], r
named_routes
.
install
(
destinations
,
regenerate_code
)
end
# ROUTES TODO: Revisit the name of these methods
def
url_helpers
@url_helpers
||=
begin
def
url_for
@url_for
||=
begin
router
=
self
Module
.
new
do
extend
ActiveSupport
::
Concern
...
...
@@ -272,13 +271,13 @@ def url_helpers
end
end
def
named_
url_helpers
@
named_
url_helpers
||=
begin
def
url_helpers
@url_helpers
||=
begin
router
=
self
Module
.
new
do
extend
ActiveSupport
::
Concern
include
router
.
url_
helpers
include
router
.
url_
for
# ROUTES TODO: install_helpers isn't great... can we make a module with the stuff that
# we can include?
...
...
actionpack/lib/action_dispatch/testing/assertions/routing.rb
浏览文件 @
98f77e08
...
...
@@ -145,14 +145,14 @@ def with_routing
old_routes
,
@router
=
@router
,
ActionDispatch
::
Routing
::
RouteSet
.
new
old_controller
,
@controller
=
@controller
,
@controller
.
clone
if
@controller
# ROUTES TODO: Figure out this insanity
silence_warnings
{
::
ActionController
.
const_set
(
:UrlFor
,
@router
.
named_
url_helpers
)
}
silence_warnings
{
::
ActionController
.
const_set
(
:UrlFor
,
@router
.
url_helpers
)
}
_router
=
@router
@controller
.
singleton_class
.
send
(
:send
,
:include
,
@router
.
named_
url_helpers
)
if
@controller
@controller
.
singleton_class
.
send
(
:send
,
:include
,
@router
.
url_helpers
)
if
@controller
yield
@router
ensure
@router
=
old_routes
@controller
=
old_controller
if
@controller
silence_warnings
{
::
ActionController
.
const_set
(
:UrlFor
,
@router
.
named_
url_helpers
)
}
if
@router
silence_warnings
{
::
ActionController
.
const_set
(
:UrlFor
,
@router
.
url_helpers
)
}
if
@router
end
def
method_missing
(
selector
,
*
args
,
&
block
)
...
...
actionpack/test/abstract_unit.rb
浏览文件 @
98f77e08
...
...
@@ -256,7 +256,7 @@ def assert_template(options = {}, message = nil)
# ROUTES TODO: Cleaner way to do this?
module
ActionController
UrlFor
=
SharedTestRoutes
.
named_
url_helpers
UrlFor
=
SharedTestRoutes
.
url_helpers
class
Base
include
UrlFor
end
...
...
actionpack/test/activerecord/polymorphic_routes_test.rb
浏览文件 @
98f77e08
...
...
@@ -400,7 +400,7 @@ def with_test_routes(options = {})
map
.
resources
:series
end
self
.
class
.
send
(
:include
,
@router
.
named_
url_helpers
)
self
.
class
.
send
(
:include
,
@router
.
url_helpers
)
yield
end
end
...
...
@@ -422,7 +422,7 @@ def with_admin_test_routes(options = {})
end
end
self
.
class
.
send
(
:include
,
@router
.
named_
url_helpers
)
self
.
class
.
send
(
:include
,
@router
.
url_helpers
)
yield
end
end
...
...
@@ -441,7 +441,7 @@ def with_admin_and_site_test_routes(options = {})
end
end
self
.
class
.
send
(
:include
,
@router
.
named_
url_helpers
)
self
.
class
.
send
(
:include
,
@router
.
url_helpers
)
yield
end
end
...
...
actionpack/test/controller/caching_test.rb
浏览文件 @
98f77e08
...
...
@@ -512,7 +512,7 @@ def reset!
@response
=
ActionController
::
TestResponse
.
new
@controller
=
ActionCachingTestController
.
new
# ROUTES TODO: It seems bad to explicitly remix in the class
@controller
.
singleton_class
.
send
(
:include
,
@router
.
named_
url_helpers
)
@controller
.
singleton_class
.
send
(
:include
,
@router
.
url_helpers
)
@request
.
host
=
'hostname.com'
end
...
...
actionpack/test/controller/integration_test.rb
浏览文件 @
98f77e08
...
...
@@ -221,7 +221,7 @@ def test_integration_methods_called
end
class
IntegrationProcessTest
<
ActionController
::
IntegrationTest
include
SharedTestRoutes
.
named_
url_helpers
include
SharedTestRoutes
.
url_helpers
class
IntegrationController
<
ActionController
::
Base
def
get
...
...
@@ -388,7 +388,7 @@ def with_test_route_set
with_routing
do
|
set
|
controller
=
::
IntegrationProcessTest
::
IntegrationController
.
clone
controller
.
class_eval
do
include
set
.
named_
url_helpers
include
set
.
url_helpers
end
set
.
draw
do
|
map
|
...
...
@@ -396,7 +396,7 @@ def with_test_route_set
get
'get/:action'
,
:to
=>
controller
end
self
.
singleton_class
.
send
(
:include
,
set
.
named_
url_helpers
)
self
.
singleton_class
.
send
(
:include
,
set
.
url_helpers
)
yield
end
...
...
@@ -404,7 +404,7 @@ def with_test_route_set
end
class
MetalIntegrationTest
<
ActionController
::
IntegrationTest
include
SharedTestRoutes
.
named_
url_helpers
include
SharedTestRoutes
.
url_helpers
class
Poller
def
self
.
call
(
env
)
...
...
actionpack/test/controller/resources_test.rb
浏览文件 @
98f77e08
...
...
@@ -1231,7 +1231,7 @@ def assert_restful_named_routes_for(controller_name, singular_name = nil, option
@controller
=
"
#{
options
[
:options
][
:controller
].
camelize
}
Controller"
.
constantize
.
new
# ROUTES TODO: Figure out a way to not extend the routing helpers here
@controller
.
singleton_class
.
send
(
:include
,
@router
.
named_
url_helpers
)
@controller
.
singleton_class
.
send
(
:include
,
@router
.
url_helpers
)
@request
=
ActionController
::
TestRequest
.
new
@response
=
ActionController
::
TestResponse
.
new
get
:index
,
options
[
:options
]
...
...
@@ -1301,7 +1301,7 @@ def assert_singleton_routes_for(singleton_name, options = {})
def
assert_singleton_named_routes_for
(
singleton_name
,
options
=
{})
(
options
[
:options
]
||=
{})[
:controller
]
||=
singleton_name
.
to_s
.
pluralize
@controller
=
"
#{
options
[
:options
][
:controller
].
camelize
}
Controller"
.
constantize
.
new
@controller
.
singleton_class
.
send
(
:include
,
@router
.
named_
url_helpers
)
@controller
.
singleton_class
.
send
(
:include
,
@router
.
url_helpers
)
@request
=
ActionController
::
TestRequest
.
new
@response
=
ActionController
::
TestResponse
.
new
get
:show
,
options
[
:options
]
...
...
actionpack/test/controller/routing_test.rb
浏览文件 @
98f77e08
...
...
@@ -251,7 +251,7 @@ def test_optimised_named_route_with_host
def
setup_for_named_route
inst
=
MockController
.
clone
.
new
inst
.
class
.
send
(
:include
,
rs
.
named_
url_helpers
)
inst
.
class
.
send
(
:include
,
rs
.
url_helpers
)
inst
end
...
...
@@ -741,7 +741,7 @@ def setup_named_route_test
map
.
users
'/admin/users'
,
:controller
=>
'admin/users'
,
:action
=>
'index'
end
MockController
.
clone
.
new
.
tap
{
|
inst
|
inst
.
class
.
send
(
:include
,
set
.
named_
url_helpers
)}
MockController
.
clone
.
new
.
tap
{
|
inst
|
inst
.
class
.
send
(
:include
,
set
.
url_helpers
)}
end
def
test_named_route_hash_access_method
...
...
actionpack/test/dispatch/routing_test.rb
浏览文件 @
98f77e08
...
...
@@ -164,7 +164,7 @@ def app
Routes
end
include
Routes
.
named_
url_helpers
include
Routes
.
url_helpers
def
test_logout
with_test_routes
do
...
...
railties/lib/rails/test_help.rb
浏览文件 @
98f77e08
...
...
@@ -31,7 +31,7 @@ class ActionController::TestCase
end
class
ActionDispatch::IntegrationTest
include
Rails
.
application
.
routes
.
named_
url_helpers
include
Rails
.
application
.
routes
.
url_helpers
end
begin
...
...
railties/test/rails_info_controller_test.rb
浏览文件 @
98f77e08
...
...
@@ -20,7 +20,7 @@ def setup
@controller
.
stubs
(
:consider_all_requests_local?
=>
false
,
:local_request?
=>
true
)
@router
=
Rails
.
application
.
routes
Rails
::
InfoController
.
send
(
:include
,
@router
.
named_
url_helpers
)
Rails
::
InfoController
.
send
(
:include
,
@router
.
url_helpers
)
end
test
"info controller does not allow remote requests"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录