質問編集履歴
5
f
test
CHANGED
File without changes
|
test
CHANGED
@@ -31,3 +31,39 @@
|
|
31
31
|
同じモデルでhas_oneを二つ別々に持ちたいのですが、上の様にしてもstart_fileとend_fileが同じになってしまいます。
|
32
32
|
|
33
33
|
何か解決する手段があればご教授いただきたいです。
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
|
47
|
+
# Table name: attachment_files
|
48
|
+
|
49
|
+
#
|
50
|
+
|
51
|
+
# id :bigint(8) not null, primary key
|
52
|
+
|
53
|
+
# attachable_type :string(255) not null
|
54
|
+
|
55
|
+
# attachable_id :bigint(8) not null
|
56
|
+
|
57
|
+
# file_data :text(65535) not null
|
58
|
+
|
59
|
+
# file_type :integer default(NULL), not null
|
60
|
+
|
61
|
+
# created_at :datetime not null
|
62
|
+
|
63
|
+
# updated_at :datetime not null
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
```
|
4
typo
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,6 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
同じモデルでhas_oneを二つ別々に持ちたいのですが、上の様にしても
|
31
|
+
同じモデルでhas_oneを二つ別々に持ちたいのですが、上の様にしてもstart_fileとend_fileが同じになってしまいます。
|
32
32
|
|
33
33
|
何か解決する手段があればご教授いただきたいです。
|
3
typop
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
has_one :start_file, class_name: 'AttachmentFile::
|
7
|
+
has_one :start_file, class_name: 'AttachmentFile::Start', as: :attachable, inverse_of: :attachable
|
8
8
|
|
9
|
-
has_one :end_file, class_name: 'AttachmentFile::E
|
9
|
+
has_one :end_file, class_name: 'AttachmentFile::End', as: :attachable, inverse_of: :attachable
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -18,9 +18,9 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
class AttachmentFile::
|
21
|
+
class AttachmentFile::Start < AttachmentFile; end
|
22
22
|
|
23
|
-
class AttachmentFile::E
|
23
|
+
class AttachmentFile::End < AttachmentFile; end
|
24
24
|
|
25
25
|
|
26
26
|
|
2
typo
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
```ruby
|
2
2
|
|
3
|
-
class
|
3
|
+
class TestData < ApplicationRecord
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
has_one :
|
7
|
+
has_one :start_file, class_name: 'AttachmentFile::Import', as: :attachable, inverse_of: :attachable
|
8
8
|
|
9
|
-
has_one :e
|
9
|
+
has_one :end_file, class_name: 'AttachmentFile::Error', as: :attachable, inverse_of: :attachable
|
10
10
|
|
11
11
|
|
12
12
|
|
1
typo
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,4 +30,4 @@
|
|
30
30
|
|
31
31
|
同じモデルでhas_oneを二つ別々に持ちたいのですが、上の様にしてもimport_fileとerror_csvが同じになってしまいます。
|
32
32
|
|
33
|
-
何か解決する手段
|
33
|
+
何か解決する手段があればご教授いただきたいです。
|