質問編集履歴

2

モデル名変更

2017/05/26 01:53

投稿

Maar
Maar

スコア48

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- class DemandDivision < ApplicationRecord
19
+ class PlanDivision < ApplicationRecord
20
20
 
21
21
  belongs_to :plan
22
22
 
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- class Demand < ApplicationRecord
29
+ class Plan < ApplicationRecord
30
30
 
31
31
  has_many :plan_divisions
32
32
 
@@ -36,7 +36,7 @@
36
36
 
37
37
 
38
38
 
39
- plan = Demand.find 1
39
+ plan = Plan.find 1
40
40
 
41
41
  plan.divisions
42
42
 

1

eit

2017/05/26 01:53

投稿

Maar
Maar

スコア48

test CHANGED
File without changes
test CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  class Division < ApplicationRecord
10
10
 
11
- has_many :demand_divisions
11
+ has_many :plan_divisions
12
12
 
13
- has_many :demands, through: :demand_divisions
13
+ has_many :plans, through: :plan_divisions
14
14
 
15
15
  end
16
16
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  class DemandDivision < ApplicationRecord
20
20
 
21
- belongs_to :demand
21
+ belongs_to :plan
22
22
 
23
23
  belongs_to :division
24
24
 
@@ -28,17 +28,17 @@
28
28
 
29
29
  class Demand < ApplicationRecord
30
30
 
31
- has_many :demand_divisions
31
+ has_many :plan_divisions
32
32
 
33
- has_many :divisions, through: :demand_divisions
33
+ has_many :divisions, through: :plan_divisions
34
34
 
35
35
  end
36
36
 
37
37
 
38
38
 
39
- demand = Demand.find 1
39
+ plan = Demand.find 1
40
40
 
41
- demand.divisions
41
+ plan.divisions
42
42
 
43
43
  >#<Division::ActiveRecord_Associations_CollectionProxy:0x3ff082b3475c>
44
44
 
@@ -54,9 +54,9 @@
54
54
 
55
55
 
56
56
 
57
- demands_divisions
57
+ plans_divisions
58
58
 
59
- |id|demand_id|division_code|
59
+ |id|plan_id|division_code|
60
60
 
61
61
  |:--|:--:|--:|
62
62
 
@@ -64,7 +64,7 @@
64
64
 
65
65
 
66
66
 
67
- demands
67
+ plans
68
68
 
69
69
  |id|title|
70
70