Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
b520d602
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,发现更多精彩内容 >>
提交
b520d602
编写于
7月 10, 2010
作者:
W
Will St. Clair + Neeraj Singh
提交者:
José Valim
7月 13, 2010
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
string IDs are now quoted correctly [#5064 state:resolved]
Signed-off-by:
N
José Valim
<
jose.valim@gmail.com
>
上级
44e7fba5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
53 addition
and
2 deletion
+53
-2
activerecord/lib/active_record/associations/through_association_scope.rb
...b/active_record/associations/through_association_scope.rb
+1
-1
activerecord/test/cases/associations/has_one_through_associations_test.rb
...t/cases/associations/has_one_through_associations_test.rb
+11
-1
activerecord/test/fixtures/dashboards.yml
activerecord/test/fixtures/dashboards.yml
+3
-0
activerecord/test/fixtures/minivans.yml
activerecord/test/fixtures/minivans.yml
+4
-0
activerecord/test/fixtures/speedometers.yml
activerecord/test/fixtures/speedometers.yml
+4
-0
activerecord/test/models/dashboard.rb
activerecord/test/models/dashboard.rb
+3
-0
activerecord/test/models/minivan.rb
activerecord/test/models/minivan.rb
+6
-0
activerecord/test/models/speedometer.rb
activerecord/test/models/speedometer.rb
+4
-0
activerecord/test/schema/schema.rb
activerecord/test/schema/schema.rb
+17
-0
未找到文件。
activerecord/lib/active_record/associations/through_association_scope.rb
浏览文件 @
b520d602
...
...
@@ -35,7 +35,7 @@ def construct_quoted_owner_attributes(reflection)
@owner
.
class
.
base_class
.
name
.
to_s
,
reflection
.
klass
.
columns_hash
[
"
#{
as
}
_type"
])
}
elsif
reflection
.
macro
==
:belongs_to
{
reflection
.
klass
.
primary_key
=>
@owner
[
reflection
.
primary_key_name
]
}
{
reflection
.
klass
.
primary_key
=>
@owner
.
class
.
quote_value
(
@owner
[
reflection
.
primary_key_name
])
}
else
{
reflection
.
primary_key_name
=>
owner_quoted_id
}
end
...
...
activerecord/test/cases/associations/has_one_through_associations_test.rb
浏览文件 @
b520d602
...
...
@@ -6,9 +6,12 @@
require
'models/sponsor'
require
'models/organization'
require
'models/member_detail'
require
'models/minivan'
require
'models/dashboard'
require
'models/speedometer'
class
HasOneThroughAssociationsTest
<
ActiveRecord
::
TestCase
fixtures
:member_types
,
:members
,
:clubs
,
:memberships
,
:sponsors
,
:organizations
fixtures
:member_types
,
:members
,
:clubs
,
:memberships
,
:sponsors
,
:organizations
,
:minivans
,
:dashboards
,
:speedometers
def
setup
@member
=
members
(
:groucho
)
...
...
@@ -202,4 +205,11 @@ def test_save_of_record_with_loaded_has_one_through
Club
.
find
(
@club
.
id
,
:include
=>
:sponsored_member
).
save!
end
end
def
test_value_is_properly_quoted
minivan
=
Minivan
.
find
(
'm1'
)
assert_nothing_raised
do
minivan
.
dashboard
end
end
end
activerecord/test/fixtures/dashboards.yml
0 → 100644
浏览文件 @
b520d602
cool_first
:
dashboard_id
:
d1
name
:
my_dashboard
\ No newline at end of file
activerecord/test/fixtures/minivans.yml
0 → 100644
浏览文件 @
b520d602
cool_first
:
minivan_id
:
m1
name
:
my_minivan
speedometer_id
:
s1
activerecord/test/fixtures/speedometers.yml
0 → 100644
浏览文件 @
b520d602
cool_first
:
speedometer_id
:
s1
name
:
my_speedometer
dashboard_id
:
d1
\ No newline at end of file
activerecord/test/models/dashboard.rb
0 → 100644
浏览文件 @
b520d602
class
Dashboard
<
ActiveRecord
::
Base
set_primary_key
:dashboard_id
end
\ No newline at end of file
activerecord/test/models/minivan.rb
0 → 100644
浏览文件 @
b520d602
class
Minivan
<
ActiveRecord
::
Base
set_primary_key
:minivan_id
belongs_to
:speedometer
has_one
:dashboard
,
:through
=>
:speedometer
end
\ No newline at end of file
activerecord/test/models/speedometer.rb
0 → 100644
浏览文件 @
b520d602
class
Speedometer
<
ActiveRecord
::
Base
set_primary_key
:speedometer_id
belongs_to
:dashboard
end
\ No newline at end of file
activerecord/test/schema/schema.rb
浏览文件 @
b520d602
...
...
@@ -164,6 +164,11 @@ def create_table(*args, &block)
t
.
string
:address_country
t
.
string
:gps_location
end
create_table
:dashboards
,
:force
=>
true
,
:id
=>
false
do
|
t
|
t
.
string
:dashboard_id
t
.
string
:name
end
create_table
:developers
,
:force
=>
true
do
|
t
|
t
.
string
:name
...
...
@@ -290,6 +295,12 @@ def create_table(*args, &block)
t
.
boolean
:favourite
t
.
integer
:lock_version
,
:default
=>
0
end
create_table
:minivans
,
:force
=>
true
,
:id
=>
false
do
|
t
|
t
.
string
:minivan_id
t
.
string
:name
t
.
string
:speedometer_id
end
create_table
:minimalistics
,
:force
=>
true
do
|
t
|
end
...
...
@@ -452,6 +463,12 @@ def create_table(*args, &block)
t
.
string
:name
t
.
integer
:ship_id
end
create_table
:speedometers
,
:force
=>
true
,
:id
=>
false
do
|
t
|
t
.
string
:speedometer_id
t
.
string
:name
t
.
string
:dashboard_id
end
create_table
:sponsors
,
:force
=>
true
do
|
t
|
t
.
integer
:club_id
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录