Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
ffb9db02
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 搜索 >>
提交
ffb9db02
编写于
5月 10, 2014
作者:
V
Vijay Dev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
copy edits [ci skip]
上级
c247370c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
14 deletion
+13
-14
actionpack/lib/action_dispatch/http/headers.rb
actionpack/lib/action_dispatch/http/headers.rb
+8
-8
activerecord/lib/active_record/attribute_assignment.rb
activerecord/lib/active_record/attribute_assignment.rb
+5
-6
未找到文件。
actionpack/lib/action_dispatch/http/headers.rb
浏览文件 @
ffb9db02
...
...
@@ -28,7 +28,7 @@ def [](key)
@env
[
env_name
(
key
)]
end
# Set the given value for the key mapped to @env.
# Set
s
the given value for the key mapped to @env.
def
[]=
(
key
,
value
)
@env
[
env_name
(
key
)]
=
value
end
...
...
@@ -36,12 +36,13 @@ def []=(key, value)
def
key?
(
key
);
@env
.
key?
key
;
end
alias
:include?
:key?
# Returns the value for the given key mapped to @env.
# If the key can’t be found, there are several options:
# with no other arguments, it will raise an KeyError exception;
# If the optional code block is specified, then that will be run and its
# result returned.
#
# If the key is not found and an optional code block is not provided,
# raises a <tt>KeyError</tt> exception.
#
# If the code block is provided, then it will be run and
# its result returned.
def
fetch
(
key
,
*
args
,
&
block
)
@env
.
fetch
env_name
(
key
),
*
args
,
&
block
end
...
...
@@ -50,7 +51,6 @@ def each(&block)
@env
.
each
(
&
block
)
end
# Returns a new Http::Headers instance containing the contents of
# <tt>headers_or_env</tt> and the original instance.
def
merge
(
headers_or_env
)
...
...
@@ -60,7 +60,7 @@ def merge(headers_or_env)
end
# Adds the contents of <tt>headers_or_env</tt> to original instance
# entries
with
duplicate keys are overwritten with the values from
# entries
;
duplicate keys are overwritten with the values from
# <tt>headers_or_env</tt>.
def
merge!
(
headers_or_env
)
headers_or_env
.
each
do
|
key
,
value
|
...
...
activerecord/lib/active_record/attribute_assignment.rb
浏览文件 @
ffb9db02
...
...
@@ -12,15 +12,14 @@ module AttributeAssignment
# of this method is +false+ an <tt>ActiveModel::ForbiddenAttributesError</tt>
# exception is raised.
#
# Example:
#
# cat = Cat.new(name: "Gorby", status: "yawning")
# cat.attributes # => {
"name" => "Gorby", "status" => "yawning"
}
# cat.attributes # => {
"name" => "Gorby", "status" => "yawning"
}
# cat.assign_attributes(status: "sleeping")
# cat.attributes # => {"name" => "Gorby", "status" => "sleeping"}
# cat.attributes # => { "name" => "Gorby", "status" => "sleeping" }
#
# New attributes will be persisted in the database when the object is saved.
#
# New attributes will be persisted to database when object is saved.
# <tt>attributes =</tt> is an alias.
# Aliased to <tt>attributes=</tt>.
def
assign_attributes
(
new_attributes
)
if
!
new_attributes
.
respond_to?
(
:stringify_keys
)
raise
ArgumentError
,
"When assigning attributes, you must pass a hash as an argument."
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录