Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
deee9d22
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,发现更多精彩内容 >>
提交
deee9d22
编写于
6月 06, 2008
作者:
J
Jeremy Kemper
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into erbout
上级
fe9d2ad6
1d1ea92f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
31 deletion
+21
-31
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/base.rb
+4
-4
activerecord/lib/active_record/validations.rb
activerecord/lib/active_record/validations.rb
+0
-9
activesupport/lib/active_support/inflector.rb
activesupport/lib/active_support/inflector.rb
+2
-2
railties/lib/rails/gem_dependency.rb
railties/lib/rails/gem_dependency.rb
+15
-16
未找到文件。
activerecord/lib/active_record/base.rb
浏览文件 @
deee9d22
...
...
@@ -2252,12 +2252,12 @@ def becomes(klass)
end
end
# Updates a single attribute and saves the record
. This is especially useful for boolean flags on existing records
.
#
Note: This method is overwritten by the Validation module that'll make sure that updates made with this
method
#
aren't subjected to validation checks. Hence, attributes can be updated even if the full object isn't valid
.
# Updates a single attribute and saves the record
without going through the normal validation procedure
.
#
This is especially useful for boolean flags on existing records. The regular +update_attribute+
method
#
in Base is replaced with this when the validations module is mixed in, which it is by default
.
def
update_attribute
(
name
,
value
)
send
(
name
.
to_s
+
'='
,
value
)
save
save
(
false
)
end
# Updates all the attributes from the passed-in Hash and saves the record. If the object is invalid, the saving will
...
...
activerecord/lib/active_record/validations.rb
浏览文件 @
deee9d22
...
...
@@ -277,7 +277,6 @@ def self.included(base) # :nodoc:
base
.
class_eval
do
alias_method_chain
:save
,
:validation
alias_method_chain
:save!
,
:validation
alias_method_chain
:update_attribute
,
:validation_skipping
end
base
.
send
:include
,
ActiveSupport
::
Callbacks
...
...
@@ -914,14 +913,6 @@ def save_with_validation!
end
end
# Updates a single attribute and saves the record without going through the normal validation procedure.
# This is especially useful for boolean flags on existing records. The regular +update_attribute+ method
# in Base is replaced with this when the validations module is mixed in, which it is by default.
def
update_attribute_with_validation_skipping
(
name
,
value
)
send
(
name
.
to_s
+
'='
,
value
)
save
(
false
)
end
# Runs +validate+ and +validate_on_create+ or +validate_on_update+ and returns true if no errors were added otherwise false.
def
valid?
errors
.
clear
...
...
activesupport/lib/active_support/inflector.rb
浏览文件 @
deee9d22
...
...
@@ -15,7 +15,7 @@ module Inflector
# A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional
# inflection rules. Examples:
#
# Inflector.inflections do |inflect|
#
ActiveSupport::
Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1\2en'
# inflect.singular /^(ox)en/i, '\1'
#
...
...
@@ -97,7 +97,7 @@ def clear(scope = :all)
# inflector rules.
#
# Example:
# Inflector.inflections do |inflect|
#
ActiveSupport::
Inflector.inflections do |inflect|
# inflect.uncountable "rails"
# end
def
inflections
...
...
railties/lib/rails/gem_dependency.rb
浏览文件 @
deee9d22
...
...
@@ -98,27 +98,26 @@ def ==(other)
self
.
name
==
other
.
name
&&
self
.
requirement
==
other
.
requirement
end
private
###################################################################
def
specification
@spec
||=
Gem
.
source_index
.
search
(
Gem
::
Dependency
.
new
(
@name
,
@requirement
)).
sort_by
{
|
s
|
s
.
version
}.
last
end
def
gem_command
RUBY_PLATFORM
=~
/win32/
?
'gem.bat'
:
'gem'
end
private
def
gem_command
RUBY_PLATFORM
=~
/win32/
?
'gem.bat'
:
'gem'
end
def
install_command
cmd
=
%w(install)
<<
@name
cmd
<<
"--version"
<<
%("#{@requirement.to_s}")
if
@requirement
cmd
<<
"--source"
<<
@source
if
@source
cmd
end
def
install_command
cmd
=
%w(install)
<<
@name
cmd
<<
"--version"
<<
%("#{@requirement.to_s}")
if
@requirement
cmd
<<
"--source"
<<
@source
if
@source
cmd
end
def
unpack_command
cmd
=
%w(unpack)
<<
@name
cmd
<<
"--version"
<<
%("#{@requirement.to_s}")
if
@requirement
cmd
end
def
unpack_command
cmd
=
%w(unpack)
<<
@name
cmd
<<
"--version"
<<
%("#{@requirement.to_s}")
if
@requirement
cmd
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录