Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c9a88a2c
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 搜索 >>
提交
c9a88a2c
编写于
10月 21, 2012
作者:
F
Francesco Rodriguez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor edits in AM documentation [ci skip]
上级
aceb4a58
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
32 addition
and
32 deletion
+32
-32
activemodel/lib/active_model/attribute_methods.rb
activemodel/lib/active_model/attribute_methods.rb
+1
-1
activemodel/lib/active_model/callbacks.rb
activemodel/lib/active_model/callbacks.rb
+1
-1
activemodel/lib/active_model/conversion.rb
activemodel/lib/active_model/conversion.rb
+1
-1
activemodel/lib/active_model/dirty.rb
activemodel/lib/active_model/dirty.rb
+1
-1
activemodel/lib/active_model/errors.rb
activemodel/lib/active_model/errors.rb
+1
-1
activemodel/lib/active_model/lint.rb
activemodel/lib/active_model/lint.rb
+4
-4
activemodel/lib/active_model/model.rb
activemodel/lib/active_model/model.rb
+1
-1
activemodel/lib/active_model/naming.rb
activemodel/lib/active_model/naming.rb
+1
-1
activemodel/lib/active_model/observing.rb
activemodel/lib/active_model/observing.rb
+3
-3
activemodel/lib/active_model/railtie.rb
activemodel/lib/active_model/railtie.rb
+2
-2
activemodel/lib/active_model/serialization.rb
activemodel/lib/active_model/serialization.rb
+1
-1
activemodel/lib/active_model/translation.rb
activemodel/lib/active_model/translation.rb
+1
-1
activemodel/lib/active_model/validations.rb
activemodel/lib/active_model/validations.rb
+1
-1
activemodel/lib/active_model/validations/acceptance.rb
activemodel/lib/active_model/validations/acceptance.rb
+1
-1
activemodel/lib/active_model/validations/callbacks.rb
activemodel/lib/active_model/validations/callbacks.rb
+1
-1
activemodel/lib/active_model/validations/confirmation.rb
activemodel/lib/active_model/validations/confirmation.rb
+1
-1
activemodel/lib/active_model/validations/exclusion.rb
activemodel/lib/active_model/validations/exclusion.rb
+1
-1
activemodel/lib/active_model/validations/inclusion.rb
activemodel/lib/active_model/validations/inclusion.rb
+1
-1
activemodel/lib/active_model/validations/length.rb
activemodel/lib/active_model/validations/length.rb
+3
-3
activemodel/lib/active_model/validations/numericality.rb
activemodel/lib/active_model/validations/numericality.rb
+2
-2
activemodel/lib/active_model/validations/presence.rb
activemodel/lib/active_model/validations/presence.rb
+2
-2
activemodel/lib/active_model/validator.rb
activemodel/lib/active_model/validator.rb
+1
-1
未找到文件。
activemodel/lib/active_model/attribute_methods.rb
浏览文件 @
c9a88a2c
...
...
@@ -11,7 +11,7 @@ module ActiveModel
# # => ActiveModel::MissingAttributeError: missing attribute: user_id
class
MissingAttributeError
<
NoMethodError
end
# == Active Model Attribute Methods
# == Active
\
Model Attribute Methods
#
# <tt>ActiveModel::AttributeMethods</tt> provides a way to add prefixes and
# suffixes to your methods as well as handling the creation of Active Record
...
...
activemodel/lib/active_model/callbacks.rb
浏览文件 @
c9a88a2c
require
'active_support/callbacks'
module
ActiveModel
# == Active
Model
Callbacks
# == Active
\Model \
Callbacks
#
# Provides an interface for any class to have Active Record like callbacks.
#
...
...
activemodel/lib/active_model/conversion.rb
浏览文件 @
c9a88a2c
require
'active_support/inflector'
module
ActiveModel
# == Active Model Conversions
# == Active
\
Model Conversions
#
# Handles default conversions: to_model, to_key, to_param, and to_partial_path.
#
...
...
activemodel/lib/active_model/dirty.rb
浏览文件 @
c9a88a2c
...
...
@@ -3,7 +3,7 @@
require
'active_support/core_ext/object/duplicable'
module
ActiveModel
# == Active
Model
Dirty
# == Active
\Model \
Dirty
#
# Provides a way to track changes in your object in the same way as
# Active Record does.
...
...
activemodel/lib/active_model/errors.rb
浏览文件 @
c9a88a2c
...
...
@@ -4,7 +4,7 @@
require
'active_support/core_ext/string/inflections'
module
ActiveModel
# == Active
Model
Errors
# == Active
\Model \
Errors
#
# Provides a modified +Hash+ that you can include in your object
# for handling error messages and interacting with Action Pack helpers.
...
...
activemodel/lib/active_model/lint.rb
浏览文件 @
c9a88a2c
module
ActiveModel
module
Lint
# == Active
Model Lint
Tests
# == Active
\Model \Lint \
Tests
#
# You can test whether an object is compliant with the Active Model API by
# You can test whether an object is compliant with the Active
\
Model API by
# including <tt>ActiveModel::Lint::Tests</tt> in your TestCase. It will
# include tests that tell you whether your object is fully compliant,
# or if not, which aspects of the API are not implemented.
...
...
@@ -71,7 +71,7 @@ def test_persisted?
assert_boolean
model
.
persisted?
,
"persisted?"
end
# == Naming
# ==
\
Naming
#
# Model.model_name must return a string with some convenience methods:
# <tt>:human</tt>, <tt>:singular</tt> and <tt>:plural</tt>. Check
...
...
@@ -85,7 +85,7 @@ def test_model_naming
assert
model_name
.
plural
.
respond_to?
(
:to_str
)
end
# == Errors Testing
# ==
\
Errors Testing
#
# Returns an object that implements [](attribute) defined which returns an
# Array of Strings that are the errors for the attribute in question.
...
...
activemodel/lib/active_model/model.rb
浏览文件 @
c9a88a2c
module
ActiveModel
# == Active
Model Basic
Model
# == Active
\Model Basic \
Model
#
# Includes the required interface for an object to interact with
# <tt>ActionPack</tt>, using different <tt>ActiveModel</tt> modules.
...
...
activemodel/lib/active_model/naming.rb
浏览文件 @
c9a88a2c
...
...
@@ -195,7 +195,7 @@ def _singularize(string, replacement='_')
end
end
# == Active
Model
Naming
# == Active
\Model \
Naming
#
# Creates a +model_name+ method on your object.
#
...
...
activemodel/lib/active_model/observing.rb
浏览文件 @
c9a88a2c
...
...
@@ -8,7 +8,7 @@
require
'active_support/descendants_tracker'
module
ActiveModel
# == Active Model Observers Activation
# == Active
\
Model Observers Activation
module
Observing
extend
ActiveSupport
::
Concern
...
...
@@ -229,7 +229,7 @@ def notify_observers(method, *extra_args)
end
end
# == Active Model Observers
# == Active
\
Model Observers
#
# Observer classes respond to life cycle callbacks to implement trigger-like
# behavior outside the original class. This is a great way to reduce the
...
...
@@ -257,7 +257,7 @@ def notify_observers(method, *extra_args)
#
# This Observer uses logger to log when specific callbacks are triggered.
#
# == Observing a class that can't be inferred
# ==
\
Observing a class that can't be inferred
#
# Observers will by default be mapped to the class with which they share a
# name. So <tt>CommentObserver</tt> will be tied to observing <tt>Comment</tt>,
...
...
activemodel/lib/active_model/railtie.rb
浏览文件 @
c9a88a2c
...
...
@@ -2,7 +2,7 @@
require
"rails"
module
ActiveModel
class
Railtie
<
Rails
::
Railtie
class
Railtie
<
Rails
::
Railtie
# :nodoc:
config
.
eager_load_namespaces
<<
ActiveModel
end
end
\ No newline at end of file
end
activemodel/lib/active_model/serialization.rb
浏览文件 @
c9a88a2c
...
...
@@ -2,7 +2,7 @@
require
'active_support/core_ext/hash/slice'
module
ActiveModel
# == Active
Model
Serialization
# == Active
\Model \
Serialization
#
# Provides a basic serialization to a serializable_hash for your object.
#
...
...
activemodel/lib/active_model/translation.rb
浏览文件 @
c9a88a2c
module
ActiveModel
# == Active
Model
Translation
# == Active
\Model \
Translation
#
# Provides integration between your object and the Rails internationalization
# (i18n) framework.
...
...
activemodel/lib/active_model/validations.rb
浏览文件 @
c9a88a2c
...
...
@@ -6,7 +6,7 @@
module
ActiveModel
# == Active Model Validations
# == Active
\
Model Validations
#
# Provides a full validation framework to your objects.
#
...
...
activemodel/lib/active_model/validations/acceptance.rb
浏览文件 @
c9a88a2c
module
ActiveModel
# == Active
Model Acceptance
Validator
# == Active
\Model Acceptance \
Validator
module
Validations
class
AcceptanceValidator
<
EachValidator
#:nodoc:
def
initialize
(
options
)
...
...
activemodel/lib/active_model/validations/callbacks.rb
浏览文件 @
c9a88a2c
...
...
@@ -2,7 +2,7 @@
module
ActiveModel
module
Validations
# == Active
Model Validation c
allbacks
# == Active
\Model Validation C
allbacks
#
# Provides an interface for any class to have +before_validation+ and
# +after_validation+ callbacks.
...
...
activemodel/lib/active_model/validations/confirmation.rb
浏览文件 @
c9a88a2c
module
ActiveModel
# == Active
Model Confirmation
Validator
# == Active
\Model Confirmation \
Validator
module
Validations
class
ConfirmationValidator
<
EachValidator
#:nodoc:
def
validate_each
(
record
,
attribute
,
value
)
...
...
activemodel/lib/active_model/validations/exclusion.rb
浏览文件 @
c9a88a2c
...
...
@@ -2,7 +2,7 @@
module
ActiveModel
# == Active
Model Exclusion
Validator
# == Active
\Model Exclusion \
Validator
module
Validations
class
ExclusionValidator
<
EachValidator
#:nodoc:
include
Clusivity
...
...
activemodel/lib/active_model/validations/inclusion.rb
浏览文件 @
c9a88a2c
...
...
@@ -2,7 +2,7 @@
module
ActiveModel
# == Active
Model Inclusion
Validator
# == Active
\Model Inclusion \
Validator
module
Validations
class
InclusionValidator
<
EachValidator
#:nodoc:
include
Clusivity
...
...
activemodel/lib/active_model/validations/length.rb
浏览文件 @
c9a88a2c
module
ActiveModel
# == Active
Model Length
Validator
# == Active
\Model Length \
Validator
module
Validations
class
LengthValidator
<
EachValidator
#:nodoc:
class
LengthValidator
<
EachValidator
#
:nodoc:
MESSAGES
=
{
:is
=>
:wrong_length
,
:minimum
=>
:too_short
,
:maximum
=>
:too_long
}.
freeze
CHECKS
=
{
:is
=>
:==
,
:minimum
=>
:
>=
,
:maximum
=>
:<=
}.
freeze
...
...
@@ -37,7 +37,7 @@ def validate_each(record, attribute, value)
value
=
tokenize
(
value
)
value_length
=
value
.
respond_to?
(
:length
)
?
value
.
length
:
value
.
to_s
.
length
errors_options
=
options
.
except
(
*
RESERVED_OPTIONS
)
CHECKS
.
each
do
|
key
,
validity_check
|
next
unless
check_value
=
options
[
key
]
next
if
value_length
.
send
(
validity_check
,
check_value
)
...
...
activemodel/lib/active_model/validations/numericality.rb
浏览文件 @
c9a88a2c
module
ActiveModel
# == Active
Model Numericality
Validator
# == Active
\Model Numericality \
Validator
module
Validations
class
NumericalityValidator
<
EachValidator
#:nodoc:
class
NumericalityValidator
<
EachValidator
#
:nodoc:
CHECKS
=
{
:greater_than
=>
:
>
,
:greater_than_or_equal_to
=>
:
>=
,
:equal_to
=>
:==
,
:less_than
=>
:<
,
:less_than_or_equal_to
=>
:<=
,
:odd
=>
:odd?
,
:even
=>
:even?
,
:other_than
=>
:
!=
}.
freeze
...
...
activemodel/lib/active_model/validations/presence.rb
浏览文件 @
c9a88a2c
module
ActiveModel
# == Active
Model Presence
Validator
# == Active
\Model Presence \
Validator
module
Validations
class
PresenceValidator
<
EachValidator
#:nodoc:
class
PresenceValidator
<
EachValidator
#
:nodoc:
def
validate
(
record
)
record
.
errors
.
add_on_blank
(
attributes
,
options
)
end
...
...
activemodel/lib/active_model/validator.rb
浏览文件 @
c9a88a2c
...
...
@@ -2,7 +2,7 @@
module
ActiveModel
# == Active
Model
Validator
# == Active
\Model \
Validator
#
# A simple base class that can be used along with
# ActiveModel::Validations::ClassMethods.validates_with
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录