Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
f6153f74
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,发现更多精彩内容 >>
提交
f6153f74
编写于
9月 11, 2010
作者:
W
wycats
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'drogus/engines'
上级
477df634
497b6af8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
41 addition
and
12 deletion
+41
-12
actionmailer/lib/action_mailer/railtie.rb
actionmailer/lib/action_mailer/railtie.rb
+1
-1
actionpack/lib/action_controller/railtie.rb
actionpack/lib/action_controller/railtie.rb
+1
-1
actionpack/lib/action_dispatch/routing/route_set.rb
actionpack/lib/action_dispatch/routing/route_set.rb
+1
-1
actionpack/test/dispatch/prefix_generation_test.rb
actionpack/test/dispatch/prefix_generation_test.rb
+4
-4
railties/lib/rails/application/configuration.rb
railties/lib/rails/application/configuration.rb
+1
-0
railties/test/application/initializers/frameworks_test.rb
railties/test/application/initializers/frameworks_test.rb
+1
-1
railties/test/application/routing_test.rb
railties/test/application/routing_test.rb
+1
-1
railties/test/railties/engine_test.rb
railties/test/railties/engine_test.rb
+29
-1
railties/test/railties/mounted_engine_test.rb
railties/test/railties/mounted_engine_test.rb
+2
-2
未找到文件。
actionmailer/lib/action_mailer/railtie.rb
浏览文件 @
f6153f74
...
@@ -21,7 +21,7 @@ class Railtie < Rails::Railtie
...
@@ -21,7 +21,7 @@ class Railtie < Rails::Railtie
ActiveSupport
.
on_load
(
:action_mailer
)
do
ActiveSupport
.
on_load
(
:action_mailer
)
do
include
AbstractController
::
UrlFor
include
AbstractController
::
UrlFor
extend
::
AbstractController
::
Railties
::
RoutesHelpers
.
with
(
app
.
routes
)
extend
::
AbstractController
::
Railties
::
RoutesHelpers
.
with
(
app
.
routes
)
include
app
.
routes
.
mounted_helpers
(
:app
)
include
app
.
routes
.
mounted_helpers
options
.
each
{
|
k
,
v
|
send
(
"
#{
k
}
="
,
v
)
}
options
.
each
{
|
k
,
v
|
send
(
"
#{
k
}
="
,
v
)
}
end
end
end
end
...
...
actionpack/lib/action_controller/railtie.rb
浏览文件 @
f6153f74
...
@@ -27,7 +27,7 @@ class Railtie < Rails::Railtie
...
@@ -27,7 +27,7 @@ class Railtie < Rails::Railtie
options
.
page_cache_directory
||=
paths
.
public
.
to_a
.
first
options
.
page_cache_directory
||=
paths
.
public
.
to_a
.
first
ActiveSupport
.
on_load
(
:action_controller
)
do
ActiveSupport
.
on_load
(
:action_controller
)
do
include
app
.
routes
.
mounted_helpers
(
:app
)
include
app
.
routes
.
mounted_helpers
extend
::
AbstractController
::
Railties
::
RoutesHelpers
.
with
(
app
.
routes
)
extend
::
AbstractController
::
Railties
::
RoutesHelpers
.
with
(
app
.
routes
)
extend
::
ActionController
::
Railties
::
Paths
.
with
(
app
)
extend
::
ActionController
::
Railties
::
Paths
.
with
(
app
)
options
.
each
{
|
k
,
v
|
send
(
"
#{
k
}
="
,
v
)
}
options
.
each
{
|
k
,
v
|
send
(
"
#{
k
}
="
,
v
)
}
...
...
actionpack/lib/action_dispatch/routing/route_set.rb
浏览文件 @
f6153f74
...
@@ -262,7 +262,7 @@ def install_helpers(destinations = [ActionController::Base, ActionView::Base], r
...
@@ -262,7 +262,7 @@ def install_helpers(destinations = [ActionController::Base, ActionView::Base], r
module
MountedHelpers
module
MountedHelpers
end
end
def
mounted_helpers
(
name
=
nil
)
def
mounted_helpers
(
name
=
:main_app
)
define_mounted_helper
(
name
)
if
name
define_mounted_helper
(
name
)
if
name
MountedHelpers
MountedHelpers
end
end
...
...
actionpack/test/dispatch/prefix_generation_test.rb
浏览文件 @
f6153f74
...
@@ -72,7 +72,7 @@ def klass.name; self end
...
@@ -72,7 +72,7 @@ def klass.name; self end
class
::
InsideEngineGeneratingController
<
ActionController
::
Base
class
::
InsideEngineGeneratingController
<
ActionController
::
Base
include
BlogEngine
.
routes
.
url_helpers
include
BlogEngine
.
routes
.
url_helpers
include
RailsApplication
.
routes
.
mounted_helpers
(
:app
)
include
RailsApplication
.
routes
.
mounted_helpers
def
index
def
index
render
:text
=>
posts_path
render
:text
=>
posts_path
...
@@ -83,9 +83,9 @@ def show
...
@@ -83,9 +83,9 @@ def show
end
end
def
url_to_application
def
url_to_application
path
=
app
.
url_for
(
:controller
=>
"outside_engine_generating"
,
path
=
main_app
.
url_for
(
:controller
=>
"outside_engine_generating"
,
:action
=>
"index"
,
:action
=>
"index"
,
:only_path
=>
true
)
:only_path
=>
true
)
render
:text
=>
path
render
:text
=>
path
end
end
...
...
railties/lib/rails/application/configuration.rb
浏览文件 @
f6153f74
...
@@ -23,6 +23,7 @@ def initialize(*)
...
@@ -23,6 +23,7 @@ def initialize(*)
@session_options
=
{}
@session_options
=
{}
@time_zone
=
"UTC"
@time_zone
=
"UTC"
@middleware
=
app_middleware
@middleware
=
app_middleware
@asset_path
=
'/'
end
end
def
asset_path
=
(
value
)
def
asset_path
=
(
value
)
...
...
railties/test/application/initializers/frameworks_test.rb
浏览文件 @
f6153f74
...
@@ -61,7 +61,7 @@ def notify
...
@@ -61,7 +61,7 @@ def notify
require
"
#{
app_path
}
/config/environment"
require
"
#{
app_path
}
/config/environment"
assert
Foo
.
method_defined?
(
:foo_path
)
assert
Foo
.
method_defined?
(
:foo_path
)
assert
Foo
.
method_defined?
(
:app
)
assert
Foo
.
method_defined?
(
:
main_
app
)
assert_equal
[
"notify"
],
Foo
.
action_methods
assert_equal
[
"notify"
],
Foo
.
action_methods
end
end
...
...
railties/test/application/routing_test.rb
浏览文件 @
f6153f74
...
@@ -203,7 +203,7 @@ def baz
...
@@ -203,7 +203,7 @@ def baz
assert_equal
'bar'
,
last_response
.
body
assert_equal
'bar'
,
last_response
.
body
app_file
'config/routes.rb'
,
<<-
RUBY
app_file
'config/routes.rb'
,
<<-
RUBY
AppTemplate::Application.routes.draw do
|map|
AppTemplate::Application.routes.draw do
match 'foo', :to => 'foo#baz'
match 'foo', :to => 'foo#baz'
end
end
RUBY
RUBY
...
...
railties/test/railties/engine_test.rb
浏览文件 @
f6153f74
...
@@ -281,6 +281,34 @@ def index
...
@@ -281,6 +281,34 @@ def index
assert_equal
expected
,
stripped_body
assert_equal
expected
,
stripped_body
end
end
test
"default application's asset_path"
do
@plugin
.
write
"config/routes.rb"
,
<<-
RUBY
Bukkits::Engine.routes.draw do
match "/foo" => "foo#index"
end
RUBY
@plugin
.
write
"app/controllers/foo_controller.rb"
,
<<-
RUBY
class FooController < ActionController::Base
def index
end
end
RUBY
@plugin
.
write
"app/views/foo/index.html.erb"
,
<<-
RUBY
<%= compute_public_path("/foo", "") %>
RUBY
boot_rails
env
=
Rack
::
MockRequest
.
env_for
(
"/foo"
)
response
=
Bukkits
::
Engine
.
call
(
env
)
stripped_body
=
response
[
2
].
body
.
strip
expected
=
"/bukkits/foo"
assert_equal
expected
,
stripped_body
end
test
"engine's files are served via ActionDispatch::Static"
do
test
"engine's files are served via ActionDispatch::Static"
do
add_to_config
"config.serve_static_assets = true"
add_to_config
"config.serve_static_assets = true"
...
@@ -437,7 +465,7 @@ def from_app
...
@@ -437,7 +465,7 @@ def from_app
end
end
def routes_helpers_in_view
def routes_helpers_in_view
render :inline => "<%= foo_path %>, <%= app.bar_path %>"
render :inline => "<%= foo_path %>, <%=
main_
app.bar_path %>"
end
end
def polymorphic_path_without_namespace
def polymorphic_path_without_namespace
...
...
railties/test/railties/mounted_engine_test.rb
浏览文件 @
f6153f74
...
@@ -70,14 +70,14 @@ def index
...
@@ -70,14 +70,14 @@ def index
end
end
def generate_application_route
def generate_application_route
path = app.url_for(:controller => "/main",
path =
main_
app.url_for(:controller => "/main",
:action => "index",
:action => "index",
:only_path => true)
:only_path => true)
render :text => path
render :text => path
end
end
def application_route_in_view
def application_route_in_view
render :inline => "<%= app.root_path %>"
render :inline => "<%=
main_
app.root_path %>"
end
end
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录