Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
1bb02006
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,发现更多精彩内容 >>
提交
1bb02006
编写于
1月 02, 2013
作者:
A
Amparo Luna + Guillermo Iguaran
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change docs to use update instead of update_attributes
上级
1f3a1fed
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
12 addition
and
12 deletion
+12
-12
actionpack/lib/action_controller/metal/strong_parameters.rb
actionpack/lib/action_controller/metal/strong_parameters.rb
+2
-2
actionpack/lib/action_view/helpers/form_helper.rb
actionpack/lib/action_view/helpers/form_helper.rb
+4
-4
actionpack/lib/action_view/helpers/form_options_helper.rb
actionpack/lib/action_view/helpers/form_options_helper.rb
+1
-1
actionpack/lib/action_view/record_identifier.rb
actionpack/lib/action_view/record_identifier.rb
+1
-1
activerecord/examples/performance.rb
activerecord/examples/performance.rb
+1
-1
activerecord/lib/active_record/nested_attributes.rb
activerecord/lib/active_record/nested_attributes.rb
+1
-1
activerecord/lib/active_record/persistence.rb
activerecord/lib/active_record/persistence.rb
+1
-1
activesupport/lib/active_support/core_ext/hash/except.rb
activesupport/lib/active_support/core_ext/hash/except.rb
+1
-1
未找到文件。
actionpack/lib/action_controller/metal/strong_parameters.rb
浏览文件 @
1bb02006
...
@@ -41,7 +41,7 @@ def initialize(param) # :nodoc:
...
@@ -41,7 +41,7 @@ def initialize(param) # :nodoc:
# permitted.class # => ActionController::Parameters
# permitted.class # => ActionController::Parameters
# permitted.permitted? # => true
# permitted.permitted? # => true
#
#
# Person.first.update
_attributes
!(permitted)
# Person.first.update!(permitted)
# # => #<Person id: 1, name: "Francesco", age: 22, role: "user">
# # => #<Person id: 1, name: "Francesco", age: 22, role: "user">
#
#
# It provides a +permit_all_parameters+ option that controls the top-level
# It provides a +permit_all_parameters+ option that controls the top-level
...
@@ -329,7 +329,7 @@ def each_element(object)
...
@@ -329,7 +329,7 @@ def each_element(object)
# # into a 400 Bad Request reply.
# # into a 400 Bad Request reply.
# def update
# def update
# redirect_to current_account.people.find(params[:id]).tap { |person|
# redirect_to current_account.people.find(params[:id]).tap { |person|
# person.update
_attributes
!(person_params)
# person.update!(person_params)
# }
# }
# end
# end
#
#
...
...
actionpack/lib/action_view/helpers/form_helper.rb
浏览文件 @
1bb02006
...
@@ -101,9 +101,9 @@ module Helpers
...
@@ -101,9 +101,9 @@ module Helpers
# and generate HTML accordingly.
# and generate HTML accordingly.
#
#
# The controller would receive the form data again in <tt>params[:person]</tt>, ready to be
# The controller would receive the form data again in <tt>params[:person]</tt>, ready to be
# passed to <tt>Person#update
_attributes
</tt>:
# passed to <tt>Person#update</tt>:
#
#
# if @person.update
_attributes
(params[:person])
# if @person.update(params[:person])
# # success
# # success
# else
# else
# # error handling
# # error handling
...
@@ -897,7 +897,7 @@ def text_area(object_name, method, options = {})
...
@@ -897,7 +897,7 @@ def text_area(object_name, method, options = {})
# invoice the user unchecks its check box, no +paid+ parameter is sent. So,
# invoice the user unchecks its check box, no +paid+ parameter is sent. So,
# any mass-assignment idiom like
# any mass-assignment idiom like
#
#
# @invoice.update
_attributes
(params[:invoice])
# @invoice.update(params[:invoice])
#
#
# wouldn't update the flag.
# wouldn't update the flag.
#
#
...
@@ -1569,7 +1569,7 @@ def label(method, text = nil, options = {}, &block)
...
@@ -1569,7 +1569,7 @@ def label(method, text = nil, options = {}, &block)
# invoice the user unchecks its check box, no +paid+ parameter is sent. So,
# invoice the user unchecks its check box, no +paid+ parameter is sent. So,
# any mass-assignment idiom like
# any mass-assignment idiom like
#
#
# @invoice.update
_attributes
(params[:invoice])
# @invoice.update(params[:invoice])
#
#
# wouldn't update the flag.
# wouldn't update the flag.
#
#
...
...
actionpack/lib/action_view/helpers/form_options_helper.rb
浏览文件 @
1bb02006
...
@@ -130,7 +130,7 @@ module FormOptionsHelper
...
@@ -130,7 +130,7 @@ module FormOptionsHelper
# the user deselects all roles from +role_ids+ multiple select box, no +role_ids+ parameter is sent. So,
# the user deselects all roles from +role_ids+ multiple select box, no +role_ids+ parameter is sent. So,
# any mass-assignment idiom like
# any mass-assignment idiom like
#
#
# @user.update
_attributes
(params[:user])
# @user.update(params[:user])
#
#
# wouldn't update roles.
# wouldn't update roles.
#
#
...
...
actionpack/lib/action_view/record_identifier.rb
浏览文件 @
1bb02006
...
@@ -17,7 +17,7 @@ module ActionView
...
@@ -17,7 +17,7 @@ module ActionView
# # controller
# # controller
# def update
# def update
# post = Post.find(params[:id])
# post = Post.find(params[:id])
# post.update
_attributes
(params[:post])
# post.update(params[:post])
#
#
# redirect_to(post) # Calls polymorphic_url(post) which in turn calls post_url(post)
# redirect_to(post) # Calls polymorphic_url(post) which in turn calls post_url(post)
# end
# end
...
...
activerecord/examples/performance.rb
浏览文件 @
1bb02006
...
@@ -143,7 +143,7 @@ def self.email
...
@@ -143,7 +143,7 @@ def self.email
end
end
x
.
report
'Resource#update'
do
x
.
report
'Resource#update'
do
Exhibit
.
first
.
update
_attributes
(
:name
=>
'bob'
)
Exhibit
.
first
.
update
(
name:
'bob'
)
end
end
x
.
report
'Resource#destroy'
do
x
.
report
'Resource#destroy'
do
...
...
activerecord/lib/active_record/nested_attributes.rb
浏览文件 @
1bb02006
...
@@ -58,7 +58,7 @@ class TooManyRecords < ActiveRecordError
...
@@ -58,7 +58,7 @@ class TooManyRecords < ActiveRecordError
# It also allows you to update the avatar through the member:
# It also allows you to update the avatar through the member:
#
#
# params = { member: { avatar_attributes: { id: '2', icon: 'sad' } } }
# params = { member: { avatar_attributes: { id: '2', icon: 'sad' } } }
# member.update
_attributes
params[:member]
# member.update params[:member]
# member.avatar.icon # => 'sad'
# member.avatar.icon # => 'sad'
#
#
# By default you will only be able to set and update attributes on the
# By default you will only be able to set and update attributes on the
...
...
activerecord/lib/active_record/persistence.rb
浏览文件 @
1bb02006
...
@@ -223,7 +223,7 @@ def update(attributes)
...
@@ -223,7 +223,7 @@ def update(attributes)
alias
update_attributes
update
alias
update_attributes
update
# Updates its receiver just like +update
_attributes
+ but calls <tt>save!</tt> instead
# Updates its receiver just like +update+ but calls <tt>save!</tt> instead
# of +save+, so an exception is raised if the record is invalid.
# of +save+, so an exception is raised if the record is invalid.
def
update!
(
attributes
)
def
update!
(
attributes
)
# The following transaction covers any possible database side-effects of the
# The following transaction covers any possible database side-effects of the
...
...
activesupport/lib/active_support/core_ext/hash/except.rb
浏览文件 @
1bb02006
...
@@ -2,7 +2,7 @@ class Hash
...
@@ -2,7 +2,7 @@ class Hash
# Return a hash that includes everything but the given keys. This is useful for
# Return a hash that includes everything but the given keys. This is useful for
# limiting a set of parameters to everything but a few known toggles:
# limiting a set of parameters to everything but a few known toggles:
#
#
# @person.update
_attributes
(params[:person].except(:admin))
# @person.update(params[:person].except(:admin))
def
except
(
*
keys
)
def
except
(
*
keys
)
dup
.
except!
(
*
keys
)
dup
.
except!
(
*
keys
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录