Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
6067d162
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 搜索 >>
提交
6067d162
编写于
9月 27, 2010
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Call it compile_methods! and do the same on AM.
上级
e1b51955
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
6 deletion
+16
-6
actionmailer/lib/action_mailer/railtie.rb
actionmailer/lib/action_mailer/railtie.rb
+10
-0
actionpack/lib/action_controller/railtie.rb
actionpack/lib/action_controller/railtie.rb
+2
-2
activesupport/lib/active_support/configurable.rb
activesupport/lib/active_support/configurable.rb
+3
-3
activesupport/test/configurable_test.rb
activesupport/test/configurable_test.rb
+1
-1
未找到文件。
actionmailer/lib/action_mailer/railtie.rb
浏览文件 @
6067d162
...
...
@@ -18,6 +18,10 @@ class Railtie < Rails::Railtie
options
.
javascripts_dir
||=
paths
.
public
.
javascripts
.
to_a
.
first
options
.
stylesheets_dir
||=
paths
.
public
.
stylesheets
.
to_a
.
first
# make sure readers methods get compiled
options
.
asset_path
||=
nil
options
.
asset_host
||=
nil
ActiveSupport
.
on_load
(
:action_mailer
)
do
include
AbstractController
::
UrlFor
extend
::
AbstractController
::
Railties
::
RoutesHelpers
.
with
(
app
.
routes
)
...
...
@@ -25,5 +29,11 @@ class Railtie < Rails::Railtie
options
.
each
{
|
k
,
v
|
send
(
"
#{
k
}
="
,
v
)
}
end
end
initializer
"action_mailer.compile_config_methods"
do
ActiveSupport
.
on_load
(
:action_mailer
)
do
config
.
compile_methods!
if
config
.
respond_to?
(
:compile_methods!
)
end
end
end
end
actionpack/lib/action_controller/railtie.rb
浏览文件 @
6067d162
...
...
@@ -38,9 +38,9 @@ class Railtie < Rails::Railtie
end
end
config
.
after_initialize
do
initializer
"action_controller.compile_config_methods"
do
ActiveSupport
.
on_load
(
:action_controller
)
do
config
.
c
rystalize!
if
config
.
respond_to?
(
:crystalize
!
)
config
.
c
ompile_methods!
if
config
.
respond_to?
(
:compile_methods
!
)
end
end
end
...
...
activesupport/lib/active_support/configurable.rb
浏览文件 @
6067d162
...
...
@@ -10,12 +10,12 @@ module Configurable
extend
ActiveSupport
::
Concern
class
Configuration
<
ActiveSupport
::
InheritableOptions
def
c
rystalize
!
self
.
class
.
c
rystalize
!
(
keys
.
reject
{
|
key
|
respond_to?
(
key
)})
def
c
ompile_methods
!
self
.
class
.
c
ompile_methods
!
(
keys
.
reject
{
|
key
|
respond_to?
(
key
)})
end
# compiles reader methods so we don't have to go through method_missing
def
self
.
c
rystalize
!
(
keys
)
def
self
.
c
ompile_methods
!
(
keys
)
keys
.
each
do
|
key
|
class_eval
<<-
RUBY
,
__FILE__
,
__LINE__
+
1
def
#{
key
}
; _get(
#{
key
.
inspect
}
); end
...
...
activesupport/test/configurable_test.rb
浏览文件 @
6067d162
...
...
@@ -49,7 +49,7 @@ class Child < Parent
assert
!
child
.
config
.
respond_to?
(
:bar
)
assert
!
child
.
new
.
config
.
respond_to?
(
:bar
)
parent
.
config
.
c
rystalize
!
parent
.
config
.
c
ompile_methods
!
assert_equal
:foo
,
parent
.
config
.
bar
assert_equal
:foo
,
child
.
new
.
config
.
bar
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录