質問編集履歴

2

controllerの追記

2020/02/14 02:44

投稿

KOO_
KOO_

スコア58

test CHANGED
File without changes
test CHANGED
@@ -80,6 +80,8 @@
80
80
 
81
81
 
82
82
 
83
+ ```controller
84
+
83
85
 
84
86
 
85
87
  class ContactController < ApplicationController
@@ -137,3 +139,5 @@
137
139
  end
138
140
 
139
141
  end
142
+
143
+ ```

1

controller追加

2020/02/14 02:44

投稿

KOO_
KOO_

スコア58

test CHANGED
File without changes
test CHANGED
@@ -75,3 +75,65 @@
75
75
 
76
76
 
77
77
  よろしくお願い致します。
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+ class ContactController < ApplicationController
86
+
87
+ layout "app"
88
+
89
+ def index
90
+
91
+ @contact = Contact.new
92
+
93
+ render :action => 'index'
94
+
95
+ end
96
+
97
+
98
+
99
+ def confirm
100
+
101
+ @contact = Contact.new(contact_params)
102
+
103
+ if @contact.valid?
104
+
105
+ render :action => 'confirm'
106
+
107
+ else
108
+
109
+ render :action => 'index'
110
+
111
+ end
112
+
113
+ end
114
+
115
+
116
+
117
+ def thanks
118
+
119
+ @contact = Contact.new(contact_params)
120
+
121
+ ContactMailer.received_email(@contact).deliver
122
+
123
+ end
124
+
125
+
126
+
127
+ private
128
+
129
+ def contact_params
130
+
131
+ params.require(:contact).permit(
132
+
133
+ :subsidy
134
+
135
+ )
136
+
137
+ end
138
+
139
+ end