質問するログイン新規登録

質問編集履歴

1

controllerの記述

2021/11/01 12:11

投稿

takuyahori
takuyahori

スコア0

title CHANGED
File without changes
body CHANGED
@@ -31,20 +31,22 @@
31
31
  root 'tops#index'
32
32
  end
33
33
  ```
34
- ```Rails
34
+ ```ragistrasitons_controller.rb
35
+ # frozen_string_literal: true
36
+
35
37
  class Trainers::RegistrationsController < Devise::RegistrationsController
36
38
  before_action :configure_sign_up_params, only: [:create]
37
39
  # before_action :configure_account_update_params, only: [:update]
38
40
 
39
41
  # GET /resource/sign_up
40
- # def new
42
+ def new
41
- # super
43
+ super
42
- # end
44
+ end
43
45
 
44
46
  # POST /resource
45
- # def create
47
+ def create
46
- # super
48
+ @trainer = Trainer.new(configure_sign_up_params)
47
- # end
49
+ end
48
50
 
49
51
  # GET /resource/edit
50
52
  # def edit
@@ -83,9 +85,9 @@
83
85
  # end
84
86
 
85
87
  # The path used after sign up.
86
- # def after_sign_up_path_for(resource)
88
+ def after_sign_up_path_for(resource)
87
- # super(resource)
89
+ root_path(resource)
88
- # end
90
+ end
89
91
 
90
92
  # The path used after sign up for inactive accounts.
91
93
  # def after_inactive_sign_up_path_for(resource)
@@ -93,7 +95,7 @@
93
95
  # end
94
96
  end
95
97
  ```
96
- ```Rails
98
+ ```html.erb
97
99
  <%= form_with model: @trainer, url: new_trainer_registration_path, class: 'registration-main', local: true do |f| %>
98
100
  <div class='form-wrap'>
99
101
  <div class='gorm-header'>