質問編集履歴

1

controllerの記述

2021/11/01 12:11

投稿

takuyahori
takuyahori

スコア0

test CHANGED
File without changes
test CHANGED
@@ -64,7 +64,11 @@
64
64
 
65
65
  ```
66
66
 
67
- ```Rails
67
+ ```ragistrasitons_controller.rb
68
+
69
+ # frozen_string_literal: true
70
+
71
+
68
72
 
69
73
  class Trainers::RegistrationsController < Devise::RegistrationsController
70
74
 
@@ -76,7 +80,27 @@
76
80
 
77
81
  # GET /resource/sign_up
78
82
 
79
- # def new
83
+ def new
84
+
85
+ super
86
+
87
+ end
88
+
89
+
90
+
91
+ # POST /resource
92
+
93
+ def create
94
+
95
+ @trainer = Trainer.new(configure_sign_up_params)
96
+
97
+ end
98
+
99
+
100
+
101
+ # GET /resource/edit
102
+
103
+ # def edit
80
104
 
81
105
  # super
82
106
 
@@ -84,9 +108,9 @@
84
108
 
85
109
 
86
110
 
87
- # POST /resource
111
+ # PUT /resource
88
-
112
+
89
- # def create
113
+ # def update
90
114
 
91
115
  # super
92
116
 
@@ -94,9 +118,9 @@
94
118
 
95
119
 
96
120
 
97
- # GET /resource/edit
121
+ # DELETE /resource
98
-
122
+
99
- # def edit
123
+ # def destroy
100
124
 
101
125
  # super
102
126
 
@@ -104,9 +128,17 @@
104
128
 
105
129
 
106
130
 
107
- # PUT /resource
131
+ # GET /resource/cancel
132
+
108
-
133
+ # Forces the session data which is usually expired after sign
134
+
135
+ # in to be expi red now. This is useful if the user wants to
136
+
137
+ # cancel oauth signing in/up in the middle of the process,
138
+
139
+ # removing all OAuth session data.
140
+
109
- # def update
141
+ # def cancel
110
142
 
111
143
  # super
112
144
 
@@ -114,34 +146,6 @@
114
146
 
115
147
 
116
148
 
117
- # DELETE /resource
118
-
119
- # def destroy
120
-
121
- # super
122
-
123
- # end
124
-
125
-
126
-
127
- # GET /resource/cancel
128
-
129
- # Forces the session data which is usually expired after sign
130
-
131
- # in to be expi red now. This is useful if the user wants to
132
-
133
- # cancel oauth signing in/up in the middle of the process,
134
-
135
- # removing all OAuth session data.
136
-
137
- # def cancel
138
-
139
- # super
140
-
141
- # end
142
-
143
-
144
-
145
149
  # protected
146
150
 
147
151
 
@@ -168,27 +172,27 @@
168
172
 
169
173
  # The path used after sign up.
170
174
 
171
- # def after_sign_up_path_for(resource)
175
+ def after_sign_up_path_for(resource)
176
+
177
+ root_path(resource)
178
+
179
+ end
180
+
181
+
182
+
183
+ # The path used after sign up for inactive accounts.
184
+
185
+ # def after_inactive_sign_up_path_for(resource)
172
186
 
173
187
  # super(resource)
174
188
 
175
189
  # end
176
190
 
177
-
178
-
179
- # The path used after sign up for inactive accounts.
180
-
181
- # def after_inactive_sign_up_path_for(resource)
182
-
183
- # super(resource)
184
-
185
- # end
186
-
187
191
  end
188
192
 
189
193
  ```
190
194
 
191
- ```Rails
195
+ ```html.erb
192
196
 
193
197
  <%= form_with model: @trainer, url: new_trainer_registration_path, class: 'registration-main', local: true do |f| %>
194
198