Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
5b874cf4
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,发现更多精彩内容 >>
提交
5b874cf4
编写于
12月 25, 2016
作者:
A
Akira Matsuda
提交者:
GitHub
12月 25, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #27448 from kamipo/no_need_doc_for_nodoc_classes
No need `:doc:` for `:nodoc:` classes [ci skip]
上级
e8ba0c0f
57290e63
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
15 deletion
+15
-15
activerecord/lib/active_record/associations/through_association.rb
...ord/lib/active_record/associations/through_association.rb
+1
-1
activerecord/lib/active_record/attribute.rb
activerecord/lib/active_record/attribute.rb
+4
-4
activerecord/lib/active_record/validations/uniqueness.rb
activerecord/lib/active_record/validations/uniqueness.rb
+2
-2
activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
...generators/active_record/migration/migration_generator.rb
+3
-3
activerecord/lib/rails/generators/active_record/model/model_generator.rb
...b/rails/generators/active_record/model/model_generator.rb
+5
-5
未找到文件。
activerecord/lib/active_record/associations/through_association.rb
浏览文件 @
5b874cf4
...
@@ -10,7 +10,7 @@ module ThroughAssociation #:nodoc:
...
@@ -10,7 +10,7 @@ module ThroughAssociation #:nodoc:
#
#
# 1. To get the default_scope conditions for any of the other reflections in the chain
# 1. To get the default_scope conditions for any of the other reflections in the chain
# 2. To get the type conditions for any STI models in the chain
# 2. To get the type conditions for any STI models in the chain
def
target_scope
# :doc:
def
target_scope
scope
=
super
scope
=
super
reflection
.
chain
.
drop
(
1
).
each
do
|
reflection
|
reflection
.
chain
.
drop
(
1
).
each
do
|
reflection
|
relation
=
reflection
.
klass
.
all
relation
=
reflection
.
klass
.
all
...
...
activerecord/lib/active_record/attribute.rb
浏览文件 @
5b874cf4
...
@@ -135,7 +135,7 @@ def encode_with(coder)
...
@@ -135,7 +135,7 @@ def encode_with(coder)
attr_reader
:original_attribute
attr_reader
:original_attribute
alias_method
:assigned?
,
:original_attribute
alias_method
:assigned?
,
:original_attribute
def
original_value_for_database
# :doc:
def
original_value_for_database
if
assigned?
if
assigned?
original_attribute
.
original_value_for_database
original_attribute
.
original_value_for_database
else
else
...
@@ -144,17 +144,17 @@ def original_value_for_database # :doc:
...
@@ -144,17 +144,17 @@ def original_value_for_database # :doc:
end
end
private
private
def
initialize_dup
(
other
)
# :doc:
def
initialize_dup
(
other
)
if
defined?
(
@value
)
&&
@value
.
duplicable?
if
defined?
(
@value
)
&&
@value
.
duplicable?
@value
=
@value
.
dup
@value
=
@value
.
dup
end
end
end
end
def
changed_from_assignment?
# :doc:
def
changed_from_assignment?
assigned?
&&
type
.
changed?
(
original_value
,
value
,
value_before_type_cast
)
assigned?
&&
type
.
changed?
(
original_value
,
value
,
value_before_type_cast
)
end
end
def
_original_value_for_database
# :doc:
def
_original_value_for_database
type
.
serialize
(
original_value
)
type
.
serialize
(
original_value
)
end
end
...
...
activerecord/lib/active_record/validations/uniqueness.rb
浏览文件 @
5b874cf4
...
@@ -83,7 +83,7 @@ def build_relation(klass, attribute, value)
...
@@ -83,7 +83,7 @@ def build_relation(klass, attribute, value)
end
end
end
end
def
scope_relation
(
record
,
relation
)
# :doc:
def
scope_relation
(
record
,
relation
)
Array
(
options
[
:scope
]).
each
do
|
scope_item
|
Array
(
options
[
:scope
]).
each
do
|
scope_item
|
scope_value
=
if
record
.
class
.
_reflect_on_association
(
scope_item
)
scope_value
=
if
record
.
class
.
_reflect_on_association
(
scope_item
)
record
.
association
(
scope_item
).
reader
record
.
association
(
scope_item
).
reader
...
@@ -96,7 +96,7 @@ def scope_relation(record, relation) # :doc:
...
@@ -96,7 +96,7 @@ def scope_relation(record, relation) # :doc:
relation
relation
end
end
def
map_enum_attribute
(
klass
,
attribute
,
value
)
# :doc:
def
map_enum_attribute
(
klass
,
attribute
,
value
)
mapping
=
klass
.
defined_enums
[
attribute
.
to_s
]
mapping
=
klass
.
defined_enums
[
attribute
.
to_s
]
value
=
mapping
[
value
]
if
value
&&
mapping
value
=
mapping
[
value
]
if
value
&&
mapping
value
value
...
...
activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
浏览文件 @
5b874cf4
...
@@ -23,7 +23,7 @@ def create_migration_file
...
@@ -23,7 +23,7 @@ def create_migration_file
# Sets the default migration template that is being used for the generation of the migration.
# Sets the default migration template that is being used for the generation of the migration.
# Depending on command line arguments, the migration template and the table name instance
# Depending on command line arguments, the migration template and the table name instance
# variables are set up.
# variables are set up.
def
set_local_assigns!
# :doc:
def
set_local_assigns!
@migration_template
=
"migration.rb"
@migration_template
=
"migration.rb"
case
file_name
case
file_name
when
/^(add|remove)_.*_(?:to|from)_(.*)/
when
/^(add|remove)_.*_(?:to|from)_(.*)/
...
@@ -42,13 +42,13 @@ def set_local_assigns! # :doc:
...
@@ -42,13 +42,13 @@ def set_local_assigns! # :doc:
end
end
end
end
def
set_index_names
# :doc:
def
set_index_names
attributes
.
each_with_index
do
|
attr
,
i
|
attributes
.
each_with_index
do
|
attr
,
i
|
attr
.
index_name
=
[
attr
,
attributes
[
i
-
1
]].
map
{
|
a
|
index_name_for
(
a
)
}
attr
.
index_name
=
[
attr
,
attributes
[
i
-
1
]].
map
{
|
a
|
index_name_for
(
a
)
}
end
end
end
end
def
index_name_for
(
attribute
)
# :doc:
def
index_name_for
(
attribute
)
if
attribute
.
foreign_key?
if
attribute
.
foreign_key?
attribute
.
name
attribute
.
name
else
else
...
...
activerecord/lib/rails/generators/active_record/model/model_generator.rb
浏览文件 @
5b874cf4
...
@@ -35,29 +35,29 @@ def create_module_file
...
@@ -35,29 +35,29 @@ def create_module_file
private
private
def
attributes_with_index
# :doc:
def
attributes_with_index
attributes
.
select
{
|
a
|
!
a
.
reference?
&&
a
.
has_index?
}
attributes
.
select
{
|
a
|
!
a
.
reference?
&&
a
.
has_index?
}
end
end
# FIXME: Change this file to a symlink once RubyGems 2.5.0 is required.
# FIXME: Change this file to a symlink once RubyGems 2.5.0 is required.
def
generate_application_record
# :doc:
def
generate_application_record
if
self
.
behavior
==
:invoke
&&
!
application_record_exist?
if
self
.
behavior
==
:invoke
&&
!
application_record_exist?
template
"application_record.rb"
,
application_record_file_name
template
"application_record.rb"
,
application_record_file_name
end
end
end
end
# Used by the migration template to determine the parent name of the model
# Used by the migration template to determine the parent name of the model
def
parent_class_name
# :doc:
def
parent_class_name
options
[
:parent
]
||
"ApplicationRecord"
options
[
:parent
]
||
"ApplicationRecord"
end
end
def
application_record_exist?
# :doc:
def
application_record_exist?
file_exist
=
nil
file_exist
=
nil
in_root
{
file_exist
=
File
.
exist?
(
application_record_file_name
)
}
in_root
{
file_exist
=
File
.
exist?
(
application_record_file_name
)
}
file_exist
file_exist
end
end
def
application_record_file_name
# :doc:
def
application_record_file_name
@application_record_file_name
||=
if
mountable_engine?
@application_record_file_name
||=
if
mountable_engine?
"app/models/
#{
namespaced_path
}
/application_record.rb"
"app/models/
#{
namespaced_path
}
/application_record.rb"
else
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录