Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
a2c84388
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,发现更多精彩内容 >>
提交
a2c84388
编写于
10月 12, 2012
作者:
A
AvnerCohen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.9 hash syntax changes.
上级
61c64dc9
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
262 addition
and
262 deletion
+262
-262
guides/source/active_record_validations_callbacks.md
guides/source/active_record_validations_callbacks.md
+93
-93
guides/source/active_support_core_extensions.md
guides/source/active_support_core_extensions.md
+113
-113
guides/source/active_support_instrumentation.md
guides/source/active_support_instrumentation.md
+54
-54
guides/source/api_documentation_guidelines.md
guides/source/api_documentation_guidelines.md
+2
-2
未找到文件。
guides/source/active_record_validations_callbacks.md
浏览文件 @
a2c84388
此差异已折叠。
点击以展开。
guides/source/active_support_core_extensions.md
浏览文件 @
a2c84388
此差异已折叠。
点击以展开。
guides/source/active_support_instrumentation.md
浏览文件 @
a2c84388
...
...
@@ -37,7 +37,7 @@ ActionController
```
ruby
{
:key
=>
'posts/1-dasboard-view'
key:
'posts/1-dasboard-view'
}
```
...
...
@@ -49,7 +49,7 @@ ActionController
```
ruby
{
:key
=>
'posts/1-dasboard-view'
key:
'posts/1-dasboard-view'
}
```
...
...
@@ -61,7 +61,7 @@ ActionController
```
ruby
{
:key
=>
'posts/1-dasboard-view'
key:
'posts/1-dasboard-view'
}
```
...
...
@@ -73,7 +73,7 @@ ActionController
```
ruby
{
:key
=>
'posts/1-dasboard-view'
key:
'posts/1-dasboard-view'
}
```
...
...
@@ -85,7 +85,7 @@ ActionController
```
ruby
{
:path
=>
'/users/1'
path:
'/users/1'
}
```
...
...
@@ -97,7 +97,7 @@ ActionController
```
ruby
{
:path
=>
'/users/1'
path:
'/users/1'
}
```
...
...
@@ -114,12 +114,12 @@ ActionController
```
ruby
{
:controller
=>
"PostsController"
,
:action
=>
"new"
,
:params
=>
{
"action"
=>
"new"
,
"controller"
=>
"posts"
},
:format
=>
:html
,
:method
=>
"GET"
,
:path
=>
"/posts/new"
controller:
"PostsController"
,
action:
"new"
,
params:
{
"action"
=>
"new"
,
"controller"
=>
"posts"
},
format:
:html
,
method:
"GET"
,
path:
"/posts/new"
}
```
...
...
@@ -137,15 +137,15 @@ ActionController
```
ruby
{
:controller
=>
"PostsController"
,
:action
=>
"index"
,
:params
=>
{
"action"
=>
"index"
,
"controller"
=>
"posts"
},
:format
=>
:html
,
:method
=>
"GET"
,
:path
=>
"/posts"
,
:status
=>
200
,
:view_runtime
=>
46.848
,
:db_runtime
=>
0.157
controller:
"PostsController"
,
action:
"index"
,
params:
{
"action"
=>
"index"
,
"controller"
=>
"posts"
},
format:
:html
,
method:
"GET"
,
path:
"/posts"
,
status:
200
,
view_runtime:
46.848
,
db_runtime:
0.157
}
```
...
...
@@ -170,8 +170,8 @@ INFO. Additional keys may be added by the caller.
```
ruby
{
:status
=>
302
,
:location
=>
"http://localhost:3000/posts/new"
status:
302
,
location:
"http://localhost:3000/posts/new"
}
```
...
...
@@ -183,7 +183,7 @@ INFO. Additional keys may be added by the caller.
```
ruby
{
:filter
=>
":halting_filter"
filter:
":halting_filter"
}
```
...
...
@@ -199,8 +199,8 @@ ActionView
```
ruby
{
:identifier
=>
"/Users/adam/projects/notifications/app/views/posts/index.html.erb"
,
:layout
=>
"layouts/application"
identifier:
"/Users/adam/projects/notifications/app/views/posts/index.html.erb"
,
layout:
"layouts/application"
}
```
...
...
@@ -212,7 +212,7 @@ ActionView
```
ruby
{
:identifier
=>
"/Users/adam/projects/notifications/app/views/posts/_form.html.erb"
,
identifier:
"/Users/adam/projects/notifications/app/views/posts/_form.html.erb"
,
}
```
...
...
@@ -231,10 +231,10 @@ INFO. The adapters will add their own data as well.
```
ruby
{
:sql
=>
"SELECT
\"
posts
\"
.* FROM
\"
posts
\"
"
,
:name
=>
"Post Load"
,
:connection_id
=>
70307250813140
,
:binds
=>
[]
sql:
"SELECT
\"
posts
\"
.* FROM
\"
posts
\"
"
,
name:
"Post Load"
,
connection_id:
70307250813140
,
binds:
[]
}
```
...
...
@@ -265,13 +265,13 @@ ActionMailer
```
ruby
{
:mailer
=>
"Notification"
,
:message_id
=>
"4f5b5491f1774_181b23fc3d4434d38138e5@mba.local.mail"
,
:subject
=>
"Rails Guides"
,
:to
=>
[
"users@rails.com"
,
"ddh@rails.com"
],
:from
=>
[
"me@rails.com"
],
:date
=>
Sat
,
10
Mar
2012
14
:
18
:
09
+
0100
,
:mail
=>
"..."
# ommitted for beverity
mailer:
"Notification"
,
message_id:
"4f5b5491f1774_181b23fc3d4434d38138e5@mba.local.mail"
,
subject:
"Rails Guides"
,
to:
[
"users@rails.com"
,
"ddh@rails.com"
],
from:
[
"me@rails.com"
],
date:
Sat
,
10
Mar
2012
14
:
18
:
09
+
0100
,
mail:
"..."
# ommitted for beverity
}
```
...
...
@@ -291,13 +291,13 @@ ActionMailer
```
ruby
{
:mailer
=>
"Notification"
,
:message_id
=>
"4f5b5491f1774_181b23fc3d4434d38138e5@mba.local.mail"
,
:subject
=>
"Rails Guides"
,
:to
=>
[
"users@rails.com"
,
"ddh@rails.com"
],
:from
=>
[
"me@rails.com"
],
:date
=>
Sat
,
10
Mar
2012
14
:
18
:
09
+
0100
,
:mail
=>
"..."
# ommitted for beverity
mailer:
"Notification"
,
message_id:
"4f5b5491f1774_181b23fc3d4434d38138e5@mba.local.mail"
,
subject:
"Rails Guides"
,
to:
[
"users@rails.com"
,
"ddh@rails.com"
],
from:
[
"me@rails.com"
],
date:
Sat
,
10
Mar
2012
14
:
18
:
09
+
0100
,
mail:
"..."
# ommitted for beverity
}
```
...
...
@@ -335,7 +335,7 @@ INFO. Options passed to fetch will be merged with the payload when writing to th
```
ruby
{
:key
=>
'name-of-complicated-computation'
key:
'name-of-complicated-computation'
}
```
...
...
@@ -352,7 +352,7 @@ INFO. Options passed to fetch will be merged with the payload.
```
ruby
{
:key
=>
'name-of-complicated-computation'
key:
'name-of-complicated-computation'
}
```
...
...
@@ -366,7 +366,7 @@ INFO. Cache stores my add their own keys
```
ruby
{
:key
=>
'name-of-complicated-computation'
key:
'name-of-complicated-computation'
}
```
...
...
@@ -378,7 +378,7 @@ INFO. Cache stores my add their own keys
```
ruby
{
:key
=>
'name-of-complicated-computation'
key:
'name-of-complicated-computation'
}
```
...
...
@@ -390,7 +390,7 @@ INFO. Cache stores my add their own keys
```
ruby
{
:key
=>
'name-of-complicated-computation'
key:
'name-of-complicated-computation'
}
```
...
...
@@ -434,7 +434,7 @@ ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*a
event
.
name
# => "process_action.action_controller"
event
.
duration
# => 10 (in milliseconds)
event
.
payload
# => {
:extra =>
:information }
event
.
payload
# => {
extra:
:information }
Rails
.
logger
.
info
"
#{
event
}
Received!"
end
...
...
@@ -445,7 +445,7 @@ Most times you only care about the data itself. Here is a shortuct to just get t
```
ruby
ActiveSupport
::
Notifications
.
subscribe
"process_action.action_controller"
do
|*
args
|
data
=
args
.
extract_options!
data
# {
:extra =>
:information }
data
# {
extra:
:information }
```
You may also subscribe to events matching a regular expresssion. This enables you to subscribe to
...
...
@@ -468,7 +468,7 @@ as well as the unique ID. All data passed into the `insturment` call will make i
Here's an example:
```
ruby
ActiveSupport
::
Notifications
.
instrument
"my.custom.event"
,
:this
=>
:data
do
ActiveSupport
::
Notifications
.
instrument
"my.custom.event"
,
this:
:data
do
# do your custom stuff here
end
```
...
...
@@ -477,7 +477,7 @@ Now you can listen to this event with:
```
ruby
ActiveSupport
::
Notifications
.
subscribe
"my.custom.event"
do
|
name
,
started
,
finished
,
unique_id
,
data
|
puts
data
.
inspect
# {
:this =>
:data }
puts
data
.
inspect
# {
this:
:data }
end
```
...
...
guides/source/api_documentation_guidelines.md
浏览文件 @
a2c84388
...
...
@@ -64,7 +64,7 @@ On the other hand, big chunks of structured documentation may have a separate "E
#
# Person.exists?(5)
# Person.exists?('5')
# Person.exists?(
:name =>
"David")
# Person.exists?(
name:
"David")
# Person.exists?(['name LIKE ?', "%#{query}%"])
```
...
...
@@ -88,7 +88,7 @@ If a line is too long, the comment may be placed on the next line:
# label(:post, :title, "A short title")
# # => <label for="post_title">A short title</label>
#
# label(:post, :title, "A short title",
:class =>
"title_label")
# label(:post, :title, "A short title",
class:
"title_label")
# # => <label for="post_title" class="title_label">A short title</label>
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录