Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c93f3f02
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,发现更多精彩内容 >>
未验证
提交
c93f3f02
编写于
8月 14, 2020
作者:
E
Eileen M. Uchitelle
提交者:
GitHub
8月 14, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #40046 from composerinteralia/renaming-man
Rename test models for inclusivity
上级
601006c5
d79519f2
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
474 addition
and
472 deletion
+474
-472
activerecord/test/assets/schema_dump_5_1.yml
activerecord/test/assets/schema_dump_5_1.yml
+1
-1
activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
...associations/has_and_belongs_to_many_associations_test.rb
+1
-1
activerecord/test/cases/associations/inverse_associations_test.rb
...cord/test/cases/associations/inverse_associations_test.rb
+359
-359
activerecord/test/cases/associations_test.rb
activerecord/test/cases/associations_test.rb
+5
-5
activerecord/test/cases/nested_attributes_test.rb
activerecord/test/cases/nested_attributes_test.rb
+33
-33
activerecord/test/cases/relation/where_chain_test.rb
activerecord/test/cases/relation/where_chain_test.rb
+4
-4
activerecord/test/cases/validations/absence_validation_test.rb
...erecord/test/cases/validations/absence_validation_test.rb
+5
-5
activerecord/test/cases/validations/association_validation_test.rb
...ord/test/cases/validations/association_validation_test.rb
+10
-10
activerecord/test/cases/validations/presence_validation_test.rb
...record/test/cases/validations/presence_validation_test.rb
+2
-2
activerecord/test/fixtures/essays.yml
activerecord/test/fixtures/essays.yml
+1
-1
activerecord/test/fixtures/faces.yml
activerecord/test/fixtures/faces.yml
+3
-3
activerecord/test/fixtures/humans.yml
activerecord/test/fixtures/humans.yml
+0
-0
activerecord/test/fixtures/interests.yml
activerecord/test/fixtures/interests.yml
+7
-7
activerecord/test/models/face.rb
activerecord/test/models/face.rb
+7
-7
activerecord/test/models/human.rb
activerecord/test/models/human.rb
+15
-13
activerecord/test/models/interest.rb
activerecord/test/models/interest.rb
+8
-8
activerecord/test/models/mixed_case_monkey.rb
activerecord/test/models/mixed_case_monkey.rb
+1
-1
activerecord/test/schema/schema.rb
activerecord/test/schema/schema.rb
+12
-12
未找到文件。
activerecord/test/assets/schema_dump_5_1.yml
浏览文件 @
c93f3f02
...
...
@@ -316,7 +316,7 @@ data_sources:
triangles
:
true
non_poly_ones
:
true
non_poly_twos
:
true
men
:
true
humans
:
true
faces
:
true
interests
:
true
zines
:
true
...
...
activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
浏览文件 @
c93f3f02
...
...
@@ -120,7 +120,7 @@ class Sink < ActiveRecord::Base
end
class
Source
<
ActiveRecord
::
Base
self
.
table_name
=
"
men
"
self
.
table_name
=
"
humans
"
has_and_belongs_to_many
:sinks
,
join_table: :edges
end
...
...
activerecord/test/cases/associations/inverse_associations_test.rb
浏览文件 @
c93f3f02
此差异已折叠。
点击以展开。
activerecord/test/cases/associations_test.rb
浏览文件 @
c93f3f02
...
...
@@ -19,7 +19,7 @@
require
"models/liquid"
require
"models/molecule"
require
"models/electron"
require
"models/man"
require
"models/
hu
man"
require
"models/interest"
require
"models/pirate"
require
"models/parrot"
...
...
@@ -240,13 +240,13 @@ def test_scoped_allows_conditions
end
test
"inverses get set of subsets of the association"
do
man
=
M
an
.
create
man
.
interests
.
create
human
=
Hum
an
.
create
hu
man
.
interests
.
create
man
=
Man
.
find
(
man
.
id
)
human
=
Human
.
find
(
hu
man
.
id
)
assert_queries
(
1
)
do
assert_equal
man
,
man
.
interests
.
where
(
"1=1"
).
first
.
man
assert_equal
human
,
human
.
interests
.
where
(
"1=1"
).
first
.
hu
man
end
end
...
...
activerecord/test/cases/nested_attributes_test.rb
浏览文件 @
c93f3f02
...
...
@@ -7,7 +7,7 @@
require
"models/bird"
require
"models/parrot"
require
"models/treasure"
require
"models/man"
require
"models/
hu
man"
require
"models/interest"
require
"models/owner"
require
"models/pet"
...
...
@@ -140,19 +140,19 @@ def test_do_not_allow_assigning_foreign_key_when_reusing_existing_new_record
end
def
test_reject_if_with_a_proc_which_returns_true_always_for_has_many
M
an
.
accepts_nested_attributes_for
:interests
,
reject_if:
proc
{
|
attributes
|
true
}
man
=
M
an
.
create
(
name:
"John"
)
interest
=
man
.
interests
.
create
(
topic:
"photography"
)
man
.
update
(
interests_attributes:
{
topic:
"gardening"
,
id:
interest
.
id
})
Hum
an
.
accepts_nested_attributes_for
:interests
,
reject_if:
proc
{
|
attributes
|
true
}
human
=
Hum
an
.
create
(
name:
"John"
)
interest
=
hu
man
.
interests
.
create
(
topic:
"photography"
)
hu
man
.
update
(
interests_attributes:
{
topic:
"gardening"
,
id:
interest
.
id
})
assert_equal
"photography"
,
interest
.
reload
.
topic
end
def
test_destroy_works_independent_of_reject_if
M
an
.
accepts_nested_attributes_for
:interests
,
reject_if:
proc
{
|
attributes
|
true
},
allow_destroy:
true
man
=
M
an
.
create
(
name:
"Jon"
)
interest
=
man
.
interests
.
create
(
topic:
"the ladies"
)
man
.
update
(
interests_attributes:
{
_destroy:
"1"
,
id:
interest
.
id
})
assert_empty
man
.
reload
.
interests
Hum
an
.
accepts_nested_attributes_for
:interests
,
reject_if:
proc
{
|
attributes
|
true
},
allow_destroy:
true
human
=
Hum
an
.
create
(
name:
"Jon"
)
interest
=
hu
man
.
interests
.
create
(
topic:
"the ladies"
)
hu
man
.
update
(
interests_attributes:
{
_destroy:
"1"
,
id:
interest
.
id
})
assert_empty
hu
man
.
reload
.
interests
end
def
test_reject_if_is_not_short_circuited_if_allow_destroy_is_false
...
...
@@ -169,10 +169,10 @@ def test_reject_if_is_not_short_circuited_if_allow_destroy_is_false
end
def
test_has_many_association_updating_a_single_record
M
an
.
accepts_nested_attributes_for
(
:interests
)
man
=
M
an
.
create
(
name:
"John"
)
interest
=
man
.
interests
.
create
(
topic:
"photography"
)
man
.
update
(
interests_attributes:
{
topic:
"gardening"
,
id:
interest
.
id
})
Hum
an
.
accepts_nested_attributes_for
(
:interests
)
human
=
Hum
an
.
create
(
name:
"John"
)
interest
=
hu
man
.
interests
.
create
(
topic:
"photography"
)
hu
man
.
update
(
interests_attributes:
{
topic:
"gardening"
,
id:
interest
.
id
})
assert_equal
"gardening"
,
interest
.
reload
.
topic
end
...
...
@@ -186,12 +186,12 @@ def test_reject_if_with_blank_nested_attributes_id
end
def
test_first_and_array_index_zero_methods_return_the_same_value_when_nested_attributes_are_set_to_update_existing_record
M
an
.
accepts_nested_attributes_for
(
:interests
)
man
=
M
an
.
create
(
name:
"John"
)
interest
=
man
.
interests
.
create
topic:
"gardening"
man
=
Man
.
find
man
.
id
man
.
interests_attributes
=
[{
id:
interest
.
id
,
topic:
"gardening"
}]
assert_equal
man
.
interests
.
first
.
topic
,
man
.
interests
[
0
].
topic
Hum
an
.
accepts_nested_attributes_for
(
:interests
)
human
=
Hum
an
.
create
(
name:
"John"
)
interest
=
hu
man
.
interests
.
create
topic:
"gardening"
human
=
Human
.
find
hu
man
.
id
hu
man
.
interests_attributes
=
[{
id:
interest
.
id
,
topic:
"gardening"
}]
assert_equal
human
.
interests
.
first
.
topic
,
hu
man
.
interests
[
0
].
topic
end
def
test_allows_class_to_override_setter_and_call_super
...
...
@@ -219,10 +219,10 @@ def test_accepts_nested_attributes_for_can_be_overridden_in_subclasses
end
def
test_should_not_create_duplicates_with_create_with
M
an
.
accepts_nested_attributes_for
(
:interests
)
Hum
an
.
accepts_nested_attributes_for
(
:interests
)
assert_difference
(
"Interest.count"
,
1
)
do
M
an
.
create_with
(
Hum
an
.
create_with
(
interests_attributes:
[{
topic:
"Pirate king"
}]
).
find_or_create_by!
(
name:
"Monkey D. Luffy"
...
...
@@ -817,17 +817,17 @@ def test_should_automatically_enable_autosave_on_the_association
end
def
test_validate_presence_of_parent_works_with_inverse_of
M
an
.
accepts_nested_attributes_for
(
:interests
)
assert_equal
:
man
,
M
an
.
reflect_on_association
(
:interests
).
options
[
:inverse_of
]
assert_equal
:interests
,
Interest
.
reflect_on_association
(
:man
).
options
[
:inverse_of
]
Hum
an
.
accepts_nested_attributes_for
(
:interests
)
assert_equal
:
human
,
Hum
an
.
reflect_on_association
(
:interests
).
options
[
:inverse_of
]
assert_equal
:interests
,
Interest
.
reflect_on_association
(
:
hu
man
).
options
[
:inverse_of
]
repair_validations
(
Interest
)
do
Interest
.
validates_presence_of
(
:man
)
assert_difference
"
M
an.count"
do
Interest
.
validates_presence_of
(
:
hu
man
)
assert_difference
"
Hum
an.count"
do
assert_difference
"Interest.count"
,
2
do
man
=
M
an
.
create!
(
name:
"John"
,
human
=
Hum
an
.
create!
(
name:
"John"
,
interests_attributes:
[{
topic:
"Cars"
},
{
topic:
"Sports"
}])
assert_equal
2
,
man
.
interests
.
count
assert_equal
2
,
hu
man
.
interests
.
count
end
end
end
...
...
@@ -839,14 +839,14 @@ def test_can_use_symbols_as_object_identifier
end
def
test_numeric_column_changes_from_zero_to_no_empty_string
M
an
.
accepts_nested_attributes_for
(
:interests
)
Hum
an
.
accepts_nested_attributes_for
(
:interests
)
repair_validations
(
Interest
)
do
Interest
.
validates_numericality_of
(
:zine_id
)
man
=
M
an
.
create
(
name:
"John"
)
interest
=
man
.
interests
.
create
(
topic:
"bar"
,
zine_id:
0
)
human
=
Hum
an
.
create
(
name:
"John"
)
interest
=
hu
man
.
interests
.
create
(
topic:
"bar"
,
zine_id:
0
)
assert
interest
.
save
assert_not
man
.
update
(
interests_attributes:
{
id:
interest
.
id
,
zine_id:
"foo"
})
assert_not
hu
man
.
update
(
interests_attributes:
{
id:
interest
.
id
,
zine_id:
"foo"
})
end
end
...
...
activerecord/test/cases/relation/where_chain_test.rb
浏览文件 @
c93f3f02
...
...
@@ -3,7 +3,7 @@
require
"cases/helper"
require
"models/post"
require
"models/author"
require
"models/man"
require
"models/
hu
man"
require
"models/essay"
require
"models/comment"
require
"models/categorization"
...
...
@@ -11,7 +11,7 @@
module
ActiveRecord
class
WhereChainTest
<
ActiveRecord
::
TestCase
fixtures
:posts
,
:comments
,
:authors
,
:
men
,
:essays
fixtures
:posts
,
:comments
,
:authors
,
:
humans
,
:essays
def
test_missing_with_association
assert
posts
(
:authorless
).
author
.
blank?
...
...
@@ -105,8 +105,8 @@ def test_rewhere_with_nested_condition
end
def
test_rewhere_with_polymorphic_association
relation
=
Essay
.
where
(
writer:
authors
(
:david
)).
rewhere
(
writer:
men
(
:steve
))
expected
=
Essay
.
where
(
writer:
men
(
:steve
))
relation
=
Essay
.
where
(
writer:
authors
(
:david
)).
rewhere
(
writer:
humans
(
:steve
))
expected
=
Essay
.
where
(
writer:
humans
(
:steve
))
assert_equal
expected
.
to_a
,
relation
.
to_a
end
...
...
activerecord/test/cases/validations/absence_validation_test.rb
浏览文件 @
c93f3f02
...
...
@@ -3,12 +3,12 @@
require
"cases/helper"
require
"models/face"
require
"models/interest"
require
"models/man"
require
"models/
hu
man"
require
"models/topic"
class
AbsenceValidationTest
<
ActiveRecord
::
TestCase
def
test_non_association
boy_klass
=
Class
.
new
(
M
an
)
do
boy_klass
=
Class
.
new
(
Hum
an
)
do
def
self
.
name
;
"Boy"
end
validates_absence_of
:name
end
...
...
@@ -18,7 +18,7 @@ def self.name; "Boy" end
end
def
test_has_one_marked_for_destruction
boy_klass
=
Class
.
new
(
M
an
)
do
boy_klass
=
Class
.
new
(
Hum
an
)
do
def
self
.
name
;
"Boy"
end
validates_absence_of
:face
end
...
...
@@ -32,7 +32,7 @@ def self.name; "Boy" end
end
def
test_has_many_marked_for_destruction
boy_klass
=
Class
.
new
(
M
an
)
do
boy_klass
=
Class
.
new
(
Hum
an
)
do
def
self
.
name
;
"Boy"
end
validates_absence_of
:interests
end
...
...
@@ -48,7 +48,7 @@ def self.name; "Boy" end
end
def
test_does_not_call_to_a_on_associations
boy_klass
=
Class
.
new
(
M
an
)
do
boy_klass
=
Class
.
new
(
Hum
an
)
do
def
self
.
name
;
"Boy"
end
validates_absence_of
:face
end
...
...
activerecord/test/cases/validations/association_validation_test.rb
浏览文件 @
c93f3f02
...
...
@@ -3,7 +3,7 @@
require
"cases/helper"
require
"models/topic"
require
"models/reply"
require
"models/man"
require
"models/
hu
man"
require
"models/interest"
class
AssociationValidationTest
<
ActiveRecord
::
TestCase
...
...
@@ -80,20 +80,20 @@ def test_validates_associated_missing
def
test_validates_presence_of_belongs_to_association__parent_is_new_record
repair_validations
(
Interest
)
do
# Note that Interest and
M
an have the :inverse_of option set
Interest
.
validates_presence_of
(
:man
)
man
=
M
an
.
new
(
name:
"John"
)
interest
=
man
.
interests
.
build
(
topic:
"Airplanes"
)
assert
interest
.
valid?
,
"Expected interest to be valid, but was not. Interest should have a man object associated"
# Note that Interest and
Hum
an have the :inverse_of option set
Interest
.
validates_presence_of
(
:
hu
man
)
human
=
Hum
an
.
new
(
name:
"John"
)
interest
=
hu
man
.
interests
.
build
(
topic:
"Airplanes"
)
assert
interest
.
valid?
,
"Expected interest to be valid, but was not. Interest should have a
hu
man object associated"
end
end
def
test_validates_presence_of_belongs_to_association__existing_parent
repair_validations
(
Interest
)
do
Interest
.
validates_presence_of
(
:man
)
man
=
M
an
.
create!
(
name:
"John"
)
interest
=
man
.
interests
.
build
(
topic:
"Airplanes"
)
assert
interest
.
valid?
,
"Expected interest to be valid, but was not. Interest should have a man object associated"
Interest
.
validates_presence_of
(
:
hu
man
)
human
=
Hum
an
.
create!
(
name:
"John"
)
interest
=
hu
man
.
interests
.
build
(
topic:
"Airplanes"
)
assert
interest
.
valid?
,
"Expected interest to be valid, but was not. Interest should have a
hu
man object associated"
end
end
end
activerecord/test/cases/validations/presence_validation_test.rb
浏览文件 @
c93f3f02
# frozen_string_literal: true
require
"cases/helper"
require
"models/man"
require
"models/
hu
man"
require
"models/face"
require
"models/interest"
require
"models/speedometer"
require
"models/dashboard"
class
PresenceValidationTest
<
ActiveRecord
::
TestCase
class
Boy
<
M
an
;
end
class
Boy
<
Hum
an
;
end
repair_validations
(
Boy
)
...
...
activerecord/test/fixtures/essays.yml
浏览文件 @
c93f3f02
...
...
@@ -12,5 +12,5 @@ mary_stay_home:
steve_connecting_the_dots
:
name
:
Connecting The Dots
writer_type
:
M
an
writer_type
:
Hum
an
writer_id
:
Steve
activerecord/test/fixtures/faces.yml
浏览文件 @
c93f3f02
trusting
:
description
:
trusting
man
:
gordon
hu
man
:
gordon
weather_beaten
:
description
:
weather beaten
man
:
steve
hu
man
:
steve
confused
:
description
:
confused
polymorphic_
man
:
gordon (M
an)
polymorphic_
human
:
gordon (Hum
an)
activerecord/test/fixtures/
men
.yml
→
activerecord/test/fixtures/
humans
.yml
浏览文件 @
c93f3f02
文件已移动
activerecord/test/fixtures/interests.yml
浏览文件 @
c93f3f02
trainspotting
:
topic
:
Trainspotting
zine
:
staying_in
man
:
gordon
hu
man
:
gordon
birdwatching
:
topic
:
Birdwatching
zine
:
staying_in
man
:
gordon
hu
man
:
gordon
stamp_collecting
:
topic
:
Stamp Collecting
zine
:
staying_in
man
:
gordon
hu
man
:
gordon
hunting
:
topic
:
Hunting
zine
:
going_out
man
:
steve
hu
man
:
steve
woodsmanship
:
topic
:
Woodsmanship
zine
:
going_out
man
:
steve
hu
man
:
steve
survival
:
topic
:
Survival
zine
:
going_out
man
:
steve
hu
man
:
steve
llama_wrangling
:
topic
:
Llama Wrangling
polymorphic_
man
:
gordon (M
an)
polymorphic_
human
:
gordon (Hum
an)
activerecord/test/models/face.rb
浏览文件 @
c93f3f02
# frozen_string_literal: true
class
Face
<
ActiveRecord
::
Base
belongs_to
:man
,
inverse_of: :face
belongs_to
:human
,
polymorphic:
true
belongs_to
:polymorphic_man
,
polymorphic:
true
,
inverse_of: :polymorphic_face
belongs_to
:
hu
man
,
inverse_of: :face
belongs_to
:
super_
human
,
polymorphic:
true
belongs_to
:polymorphic_
hu
man
,
polymorphic:
true
,
inverse_of: :polymorphic_face
# Oracle identifier length is limited to 30 bytes or less, `polymorphic` renamed `poly`
belongs_to
:poly_man_without_inverse
,
polymorphic:
true
belongs_to
:poly_
hu
man_without_inverse
,
polymorphic:
true
# These are "broken" inverse_of associations for the purposes of testing
belongs_to
:horrible_
man
,
class_name:
"M
an"
,
inverse_of: :horrible_face
belongs_to
:horrible_polymorphic_man
,
polymorphic:
true
,
inverse_of: :horrible_polymorphic_face
belongs_to
:horrible_
human
,
class_name:
"Hum
an"
,
inverse_of: :horrible_face
belongs_to
:horrible_polymorphic_
hu
man
,
polymorphic:
true
,
inverse_of: :horrible_polymorphic_face
validate
do
man
hu
man
end
end
activerecord/test/models/man.rb
→
activerecord/test/models/
hu
man.rb
浏览文件 @
c93f3f02
# frozen_string_literal: true
class
Man
<
ActiveRecord
::
Base
has_one
:face
,
inverse_of: :man
has_one
:polymorphic_face
,
class_name:
"Face"
,
as: :polymorphic_man
,
inverse_of: :polymorphic_man
has_one
:polymorphic_face_without_inverse
,
class_name:
"Face"
,
as: :poly_man_without_inverse
has_many
:interests
,
inverse_of: :man
class
Human
<
ActiveRecord
::
Base
self
.
table_name
=
"humans"
has_one
:face
,
inverse_of: :human
has_one
:polymorphic_face
,
class_name:
"Face"
,
as: :polymorphic_human
,
inverse_of: :polymorphic_human
has_one
:polymorphic_face_without_inverse
,
class_name:
"Face"
,
as: :poly_human_without_inverse
has_many
:interests
,
inverse_of: :human
has_many
:interests_with_callbacks
,
class_name:
"Interest"
,
before_add: :add_called
,
after_add: :add_called
,
inverse_of: :man_with_callbacks
inverse_of: :
hu
man_with_callbacks
has_many
:polymorphic_interests
,
class_name:
"Interest"
,
as: :polymorphic_man
,
inverse_of: :polymorphic_man
as: :polymorphic_
hu
man
,
inverse_of: :polymorphic_
hu
man
has_many
:polymorphic_interests_with_callbacks
,
class_name:
"Interest"
,
as: :polymorphic_man
,
as: :polymorphic_
hu
man
,
before_add: :add_called
,
after_add: :add_called
,
inverse_of: :polymorphic_man
inverse_of: :polymorphic_
hu
man
# These are "broken" inverse_of associations for the purposes of testing
has_one
:dirty_face
,
class_name:
"Face"
,
inverse_of: :dirty_man
has_many
:secret_interests
,
class_name:
"Interest"
,
inverse_of: :secret_man
has_one
:dirty_face
,
class_name:
"Face"
,
inverse_of: :dirty_
hu
man
has_many
:secret_interests
,
class_name:
"Interest"
,
inverse_of: :secret_
hu
man
has_one
:mixed_case_monkey
attribute
:add_callback_called
,
:boolean
,
default:
false
...
...
@@ -32,5 +34,5 @@ def add_called(_interest)
end
end
class
Human
<
M
an
class
SuperHuman
<
Hum
an
end
activerecord/test/models/interest.rb
浏览文件 @
c93f3f02
# frozen_string_literal: true
class
Interest
<
ActiveRecord
::
Base
belongs_to
:man
,
inverse_of: :interests
belongs_to
:man_with_callbacks
,
class_name:
"
M
an"
,
foreign_key: :man_id
,
belongs_to
:
hu
man
,
inverse_of: :interests
belongs_to
:
hu
man_with_callbacks
,
class_name:
"
Hum
an"
,
foreign_key: :
hu
man_id
,
inverse_of: :interests_with_callbacks
belongs_to
:polymorphic_man
,
polymorphic:
true
,
inverse_of: :polymorphic_interests
belongs_to
:polymorphic_man_with_callbacks
,
foreign_key: :polymorphic_man_id
,
foreign_type: :polymorphic_man_type
,
belongs_to
:polymorphic_
hu
man
,
polymorphic:
true
,
inverse_of: :polymorphic_interests
belongs_to
:polymorphic_
hu
man_with_callbacks
,
foreign_key: :polymorphic_
hu
man_id
,
foreign_type: :polymorphic_
hu
man_type
,
polymorphic:
true
,
inverse_of: :polymorphic_interests_with_callbacks
belongs_to
:zine
,
inverse_of: :interests
...
...
activerecord/test/models/mixed_case_monkey.rb
浏览文件 @
c93f3f02
# frozen_string_literal: true
class
MixedCaseMonkey
<
ActiveRecord
::
Base
belongs_to
:man
belongs_to
:
hu
man
end
activerecord/test/schema/schema.rb
浏览文件 @
c93f3f02
...
...
@@ -1009,27 +1009,27 @@
create_table
(
t
,
force:
true
)
{
}
end
create_table
:
men
,
force:
true
do
|
t
|
create_table
:
humans
,
force:
true
do
|
t
|
t
.
string
:name
end
create_table
:faces
,
force:
true
do
|
t
|
t
.
string
:description
t
.
integer
:man_id
t
.
integer
:polymorphic_man_id
t
.
string
:polymorphic_man_type
t
.
integer
:poly_man_without_inverse_id
t
.
string
:poly_man_without_inverse_type
t
.
integer
:horrible_polymorphic_man_id
t
.
string
:horrible_polymorphic_man_type
t
.
references
:human
,
polymorphic:
true
,
index:
false
t
.
integer
:
hu
man_id
t
.
integer
:polymorphic_
hu
man_id
t
.
string
:polymorphic_
hu
man_type
t
.
integer
:poly_
hu
man_without_inverse_id
t
.
string
:poly_
hu
man_without_inverse_type
t
.
integer
:horrible_polymorphic_
hu
man_id
t
.
string
:horrible_polymorphic_
hu
man_type
t
.
references
:
super_
human
,
polymorphic:
true
,
index:
false
end
create_table
:interests
,
force:
true
do
|
t
|
t
.
string
:topic
t
.
integer
:man_id
t
.
integer
:polymorphic_man_id
t
.
string
:polymorphic_man_type
t
.
integer
:
hu
man_id
t
.
integer
:polymorphic_
hu
man_id
t
.
string
:polymorphic_
hu
man_type
t
.
integer
:zine_id
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录