質問編集履歴
1
エラー画面の修正等
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,20 +1,124 @@
|
|
1
1
|
詳細データを記入した上で、データベースに保存されず困っています。
|
2
|
+
|
3
|
+
|
2
4
|
|
3
5
|
現状としては、
|
4
6
|
|
5
7
|
エラー内容は
|
6
8
|
|
7
|
-
[
|
9
|
+
![![イメージ説明](b326c1b00107263366578be522fa621c.png)説明](02d234fa211191db6cbea2885085cd31.png)](617ba9102dcac6bcd2cacddef88e1493.png)
|
10
|
+
|
11
|
+
|
8
12
|
|
9
13
|
エラーの原因をしようとbinding.pryをすると
|
10
14
|
|
11
15
|
ターミナル上
|
12
16
|
|
13
|
-
[
|
17
|
+
![イメージ説明](93bd1b3414fad4522658bf323612577d.png)
|
14
18
|
|
15
|
-
コード
|
16
19
|
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
|
23
|
+
class ApplicationsController < ApplicationController
|
24
|
+
|
25
|
+
before_action :set_application, except: [:index, :new, :create]
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
def index
|
30
|
+
|
17
|
-
|
31
|
+
@applications = Application.includes(:images).order('created_at DESC')
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
def new
|
38
|
+
|
39
|
+
@application = Application.new
|
40
|
+
|
41
|
+
@application.images.new
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
def create
|
48
|
+
|
49
|
+
@application = Application.new(application_params)
|
50
|
+
|
51
|
+
binding.pry
|
52
|
+
|
53
|
+
if @application.save
|
54
|
+
|
55
|
+
redirect_to root_path
|
56
|
+
|
57
|
+
else
|
58
|
+
|
59
|
+
render :new
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
def update
|
68
|
+
|
69
|
+
if @application.update(application_params)
|
70
|
+
|
71
|
+
redirect_to root_path
|
72
|
+
|
73
|
+
else
|
74
|
+
|
75
|
+
render :edit
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
def application_params
|
88
|
+
|
89
|
+
params.require(:application).permit(:applicant, :application_day, :application_number,:designated_product, :application_fee, images_attributes: [:src, :_destroy, :id])
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
def set_application
|
96
|
+
|
97
|
+
@application = Application.find(params[:id])
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
def edit
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
def destroy
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
```
|
18
122
|
|
19
123
|
|
20
124
|
|