Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
4dd47fb9
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 搜索 >>
提交
4dd47fb9
编写于
7月 24, 2013
作者:
A
Akira Matsuda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More unused associations in AR test models
上级
962d2d27
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
0 addition
and
13 deletion
+0
-13
activerecord/test/models/car.rb
activerecord/test/models/car.rb
+0
-3
activerecord/test/models/citation.rb
activerecord/test/models/citation.rb
+0
-3
activerecord/test/models/club.rb
activerecord/test/models/club.rb
+0
-1
activerecord/test/models/company.rb
activerecord/test/models/company.rb
+0
-2
activerecord/test/models/member.rb
activerecord/test/models/member.rb
+0
-1
activerecord/test/models/post.rb
activerecord/test/models/post.rb
+0
-1
activerecord/test/models/project.rb
activerecord/test/models/project.rb
+0
-1
activerecord/test/models/topic.rb
activerecord/test/models/topic.rb
+0
-1
未找到文件。
activerecord/test/models/car.rb
浏览文件 @
4dd47fb9
class
Car
<
ActiveRecord
::
Base
has_many
:bulbs
has_many
:funky_bulbs
,
class_name:
'FunkyBulb'
,
dependent: :destroy
has_many
:foo_bulbs
,
->
{
where
(
:name
=>
'foo'
)
},
:class_name
=>
"Bulb"
has_many
:frickinawesome_bulbs
,
->
{
where
:frickinawesome
=>
true
},
:class_name
=>
"Bulb"
has_one
:bulb
has_one
:frickinawesome_bulb
,
->
{
where
:frickinawesome
=>
true
},
:class_name
=>
"Bulb"
has_many
:tyres
has_many
:engines
,
:dependent
=>
:destroy
...
...
activerecord/test/models/citation.rb
浏览文件 @
4dd47fb9
class
Citation
<
ActiveRecord
::
Base
belongs_to
:reference_of
,
:class_name
=>
"Book"
,
:foreign_key
=>
:book2_id
belongs_to
:book1
,
:class_name
=>
"Book"
,
:foreign_key
=>
:book1_id
belongs_to
:book2
,
:class_name
=>
"Book"
,
:foreign_key
=>
:book2_id
end
activerecord/test/models/club.rb
浏览文件 @
4dd47fb9
...
...
@@ -2,7 +2,6 @@ class Club < ActiveRecord::Base
has_one
:membership
has_many
:memberships
,
:inverse_of
=>
false
has_many
:members
,
:through
=>
:memberships
has_many
:current_memberships
has_one
:sponsor
has_one
:sponsored_member
,
:through
=>
:sponsor
,
:source
=>
:sponsorable
,
:source_type
=>
"Member"
belongs_to
:category
...
...
activerecord/test/models/company.rb
浏览文件 @
4dd47fb9
...
...
@@ -49,7 +49,6 @@ class Firm < Company
has_many
:clients_like_ms
,
->
{
where
(
"name = 'Microsoft'"
).
order
(
"id"
)
},
:class_name
=>
"Client"
has_many
:clients_like_ms_with_hash_conditions
,
->
{
where
(
:name
=>
'Microsoft'
).
order
(
"id"
)
},
:class_name
=>
"Client"
has_many
:plain_clients
,
:class_name
=>
'Client'
has_many
:readonly_clients
,
->
{
readonly
},
:class_name
=>
'Client'
has_many
:clients_using_primary_key
,
:class_name
=>
'Client'
,
:primary_key
=>
'name'
,
:foreign_key
=>
'firm_name'
has_many
:clients_using_primary_key_with_delete_all
,
:class_name
=>
'Client'
,
...
...
@@ -167,7 +166,6 @@ class ExclusivelyDependentFirm < Company
has_one
:account
,
:foreign_key
=>
"firm_id"
,
:dependent
=>
:delete
has_many
:dependent_sanitized_conditional_clients_of_firm
,
->
{
order
(
"id"
).
where
(
"name = 'BigShot Inc.'"
)
},
:foreign_key
=>
"client_of"
,
:class_name
=>
"Client"
,
:dependent
=>
:delete_all
has_many
:dependent_conditional_clients_of_firm
,
->
{
order
(
"id"
).
where
(
"name = ?"
,
'BigShot Inc.'
)
},
:foreign_key
=>
"client_of"
,
:class_name
=>
"Client"
,
:dependent
=>
:delete_all
has_many
:dependent_hash_conditional_clients_of_firm
,
->
{
order
(
"id"
).
where
(
:name
=>
'BigShot Inc.'
)
},
:foreign_key
=>
"client_of"
,
:class_name
=>
"Client"
,
:dependent
=>
:delete_all
end
class
SpecialClient
<
Client
...
...
activerecord/test/models/member.rb
浏览文件 @
4dd47fb9
...
...
@@ -2,7 +2,6 @@ class Member < ActiveRecord::Base
has_one
:current_membership
has_one
:selected_membership
has_one
:membership
has_many
:fellow_members
,
:through
=>
:club
,
:source
=>
:members
has_one
:club
,
:through
=>
:current_membership
has_one
:selected_club
,
:through
=>
:selected_membership
,
:source
=>
:club
has_one
:favourite_club
,
->
{
where
"memberships.favourite = ?"
,
true
},
:through
=>
:membership
,
:source
=>
:club
...
...
activerecord/test/models/post.rb
浏览文件 @
4dd47fb9
...
...
@@ -122,7 +122,6 @@ def add_joins_and_select
has_many
:secure_readers
has_many
:readers_with_person
,
->
{
includes
(
:person
)
},
:class_name
=>
"Reader"
has_many
:people
,
:through
=>
:readers
has_many
:secure_people
,
:through
=>
:secure_readers
has_many
:single_people
,
:through
=>
:readers
has_many
:people_with_callbacks
,
:source
=>
:person
,
:through
=>
:readers
,
:before_add
=>
lambda
{
|
owner
,
reader
|
log
(
:added
,
:before
,
reader
.
first_name
)
},
...
...
activerecord/test/models/project.rb
浏览文件 @
4dd47fb9
class
Project
<
ActiveRecord
::
Base
has_and_belongs_to_many
:developers
,
->
{
distinct
.
order
'developers.name desc, developers.id desc'
}
has_and_belongs_to_many
:readonly_developers
,
->
{
readonly
},
:class_name
=>
"Developer"
has_and_belongs_to_many
:selected_developers
,
->
{
distinct
.
select
"developers.*"
},
:class_name
=>
"Developer"
has_and_belongs_to_many
:non_unique_developers
,
->
{
order
'developers.name desc, developers.id desc'
},
:class_name
=>
'Developer'
has_and_belongs_to_many
:limited_developers
,
->
{
limit
1
},
:class_name
=>
"Developer"
has_and_belongs_to_many
:developers_named_david
,
->
{
where
(
"name = 'David'"
).
distinct
},
:class_name
=>
"Developer"
...
...
activerecord/test/models/topic.rb
浏览文件 @
4dd47fb9
...
...
@@ -34,7 +34,6 @@ def two
has_many
:replies
,
:dependent
=>
:destroy
,
:foreign_key
=>
"parent_id"
has_many
:approved_replies
,
->
{
approved
},
class_name:
'Reply'
,
foreign_key:
"parent_id"
,
counter_cache:
'replies_count'
has_many
:replies_with_primary_key
,
:class_name
=>
"Reply"
,
:dependent
=>
:destroy
,
:primary_key
=>
"title"
,
:foreign_key
=>
"parent_title"
has_many
:unique_replies
,
:dependent
=>
:destroy
,
:foreign_key
=>
"parent_id"
has_many
:silly_unique_replies
,
:dependent
=>
:destroy
,
:foreign_key
=>
"parent_id"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录