質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,58 +60,150 @@
|
|
60
60
|
|
61
61
|
追記
|
62
62
|
|
63
|
+
```ここに言語を入力
|
64
|
+
|
65
|
+
Prefix Verb URI Pattern Controller#Action
|
66
|
+
|
67
|
+
teachers_new GET /teachers/new(.:format) teachers#new
|
68
|
+
|
69
|
+
new_teacher_session GET /teachers/sign_in(.:format) devise/sessions#new
|
70
|
+
|
71
|
+
teacher_session POST /teachers/sign_in(.:format) devise/sessions#create
|
72
|
+
|
73
|
+
destroy_teacher_session DELETE /teachers/sign_out(.:format) devise/sessions#destroy
|
74
|
+
|
75
|
+
new_teacher_password GET /teachers/password/new(.:format) devise/passwords#new
|
76
|
+
|
77
|
+
edit_teacher_password GET /teachers/password/edit(.:format) devise/passwords#edit
|
78
|
+
|
79
|
+
teacher_password PATCH /teachers/password(.:format) devise/passwords#update
|
80
|
+
|
81
|
+
PUT /teachers/password(.:format) devise/passwords#update
|
82
|
+
|
83
|
+
POST /teachers/password(.:format) devise/passwords#create
|
84
|
+
|
85
|
+
cancel_teacher_registration GET /teachers/cancel(.:format) devise/registrations#cancel
|
86
|
+
|
87
|
+
new_teacher_registration GET /teachers/sign_up(.:format) devise/registrations#new
|
88
|
+
|
89
|
+
edit_teacher_registration GET /teachers/edit(.:format) devise/registrations#edit
|
90
|
+
|
91
|
+
teacher_registration PATCH /teachers(.:format) devise/registrations#update
|
92
|
+
|
93
|
+
PUT /teachers(.:format) devise/registrations#update
|
94
|
+
|
95
|
+
DELETE /teachers(.:format) devise/registrations#destroy
|
96
|
+
|
97
|
+
POST /teachers(.:format) devise/registrations#create
|
98
|
+
|
99
|
+
teachers GET /teachers(.:format) teachers#index
|
100
|
+
|
101
|
+
POST /teachers(.:format) teachers#create
|
102
|
+
|
103
|
+
new_teacher GET /teachers/new(.:format) teachers#new
|
104
|
+
|
105
|
+
edit_teacher GET /teachers/:id/edit(.:format) teachers#edit
|
106
|
+
|
107
|
+
teacher GET /teachers/:id(.:format) teachers#show
|
108
|
+
|
109
|
+
PATCH /teachers/:id(.:format) teachers#update
|
110
|
+
|
111
|
+
PUT /teachers/:id(.:format) teachers#update
|
112
|
+
|
113
|
+
DELETE /teachers/:id(.:format) teachers#destroy
|
114
|
+
|
115
|
+
new_student_session GET /students/sign_in(.:format) devise/sessions#new
|
116
|
+
|
117
|
+
student_session POST /students/sign_in(.:format) devise/sessions#create
|
118
|
+
|
119
|
+
destroy_student_session DELETE /students/sign_out(.:format) devise/sessions#destroy
|
120
|
+
|
121
|
+
new_student_password GET /students/password/new(.:format) devise/passwords#new
|
122
|
+
|
123
|
+
edit_student_password GET /students/password/edit(.:format) devise/passwords#edit
|
124
|
+
|
125
|
+
student_password PATCH /students/password(.:format) devise/passwords#update
|
126
|
+
|
127
|
+
PUT /students/password(.:format) devise/passwords#update
|
128
|
+
|
129
|
+
POST /students/password(.:format) devise/passwords#create
|
130
|
+
|
131
|
+
cancel_student_registration GET /students/cancel(.:format) devise/registrations#cancel
|
132
|
+
|
133
|
+
new_student_registration GET /students/sign_up(.:format) devise/registrations#new
|
134
|
+
|
135
|
+
edit_student_registration GET /students/edit(.:format) devise/registrations#edit
|
136
|
+
|
137
|
+
student_registration PATCH /students(.:format) devise/registrations#update
|
138
|
+
|
139
|
+
PUT /students(.:format) devise/registrations#update
|
140
|
+
|
141
|
+
DELETE /students(.:format) devise/registrations#destroy
|
142
|
+
|
143
|
+
POST /students(.:format) devise/registrations#create
|
144
|
+
|
145
|
+
home_top GET /home/top(.:format) home#top
|
146
|
+
|
147
|
+
root GET / home#top
|
148
|
+
|
149
|
+
```
|
150
|
+
|
63
151
|
```ruby
|
64
152
|
|
153
|
+
class TeachersController < ApplicationController
|
154
|
+
|
155
|
+
def new
|
156
|
+
|
157
|
+
@teacher = Teacher.new
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
def create
|
162
|
+
|
163
|
+
@teacher = Teacher.new(teacher_params)
|
164
|
+
|
65
|
-
|
165
|
+
@teacher.save
|
66
|
-
|
67
|
-
|
166
|
+
|
68
|
-
|
69
|
-
|
167
|
+
redirect_to teachers_path #リダイレクト先はご自由に設定しましょう。
|
70
|
-
|
71
|
-
|
168
|
+
|
72
|
-
|
73
|
-
|
169
|
+
end
|
74
|
-
|
75
|
-
|
170
|
+
|
76
|
-
|
77
|
-
|
171
|
+
|
78
|
-
|
172
|
+
|
79
|
-
|
173
|
+
def edit
|
80
|
-
|
81
|
-
|
174
|
+
|
82
|
-
|
83
|
-
|
175
|
+
@teacher = Teacher.find(id: params[:id])
|
84
|
-
|
176
|
+
|
85
|
-
|
177
|
+
@teacher.save
|
86
|
-
|
87
|
-
|
178
|
+
|
88
|
-
|
89
|
-
new_teacher_registration GET /teachers/sign_up(.:format) devise/registrations#new
|
90
|
-
|
91
|
-
edit_teacher_registration GET /teachers/edit(.:format) devise/registrations#edit
|
92
|
-
|
93
|
-
|
179
|
+
redirect_to teachers_path
|
94
|
-
|
180
|
+
|
95
|
-
|
181
|
+
end
|
96
|
-
|
182
|
+
|
183
|
+
|
184
|
+
|
97
|
-
|
185
|
+
end
|
98
|
-
|
99
|
-
POST /teachers(.:format) devise/registrations#create
|
100
186
|
|
101
187
|
```
|
102
188
|
|
103
189
|
```ruby
|
104
190
|
|
105
|
-
|
191
|
+
Rails.application.routes.draw do
|
106
|
-
|
192
|
+
|
107
|
-
|
193
|
+
get 'teachers/new'
|
108
|
-
|
194
|
+
|
109
|
-
|
195
|
+
devise_for :teachers
|
196
|
+
|
110
|
-
|
197
|
+
resources :teachers
|
198
|
+
|
111
|
-
en
|
199
|
+
devise_for :students
|
112
|
-
|
113
|
-
|
114
|
-
|
200
|
+
|
115
|
-
e
|
201
|
+
get 'home/top'
|
202
|
+
|
116
|
-
|
203
|
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.htm
|
204
|
+
|
205
|
+
root to: "home#top"
|
206
|
+
|
207
|
+
|
208
|
+
|
117
|
-
```
|
209
|
+
```
|
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,6 +27,8 @@
|
|
27
27
|
一応調べてみたところ、他の人の解決方法で次のようにどこに飛ばせば良いのかかけば良いとありますが、
|
28
28
|
|
29
29
|
この仕組み(:urlからの記述の意味)がよくわかっておりません><
|
30
|
+
|
31
|
+
(以下の記述は私が作るものとは無関係のものです)
|
30
32
|
|
31
33
|
```ここに言語を入力
|
32
34
|
|
@@ -108,6 +110,8 @@
|
|
108
110
|
|
109
111
|
end
|
110
112
|
|
113
|
+
|
114
|
+
|
111
115
|
end
|
112
116
|
|
113
117
|
```
|
1
rake routesの記述、コントローラーの記述
test
CHANGED
File without changes
|
test
CHANGED
@@ -53,3 +53,61 @@
|
|
53
53
|
|
54
54
|
|
55
55
|
お力を貸していただけると嬉しいです
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
追記
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
|
63
|
+
$ rake routes
|
64
|
+
|
65
|
+
Prefix Verb URI Pattern Controller#Action
|
66
|
+
|
67
|
+
teachers_new GET /teachers/new(.:format) teachers#new
|
68
|
+
|
69
|
+
new_teacher_session GET /teachers/sign_in(.:format) devise/sessions#new
|
70
|
+
|
71
|
+
teacher_session POST /teachers/sign_in(.:format) devise/sessions#create
|
72
|
+
|
73
|
+
destroy_teacher_session DELETE /teachers/sign_out(.:format) devise/sessions#destroy
|
74
|
+
|
75
|
+
new_teacher_password GET /teachers/password/new(.:format) devise/passwords#new
|
76
|
+
|
77
|
+
edit_teacher_password GET /teachers/password/edit(.:format) devise/passwords#edit
|
78
|
+
|
79
|
+
teacher_password PATCH /teachers/password(.:format) devise/passwords#update
|
80
|
+
|
81
|
+
PUT /teachers/password(.:format) devise/passwords#update
|
82
|
+
|
83
|
+
POST /teachers/password(.:format) devise/passwords#create
|
84
|
+
|
85
|
+
cancel_teacher_registration GET /teachers/cancel(.:format) devise/registrations#cancel
|
86
|
+
|
87
|
+
new_teacher_registration GET /teachers/sign_up(.:format) devise/registrations#new
|
88
|
+
|
89
|
+
edit_teacher_registration GET /teachers/edit(.:format) devise/registrations#edit
|
90
|
+
|
91
|
+
teacher_registration PATCH /teachers(.:format) devise/registrations#update
|
92
|
+
|
93
|
+
PUT /teachers(.:format) devise/registrations#update
|
94
|
+
|
95
|
+
DELETE /teachers(.:format) devise/registrations#destroy
|
96
|
+
|
97
|
+
POST /teachers(.:format) devise/registrations#create
|
98
|
+
|
99
|
+
```
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
|
103
|
+
class TeachersController < ApplicationController
|
104
|
+
|
105
|
+
def new
|
106
|
+
|
107
|
+
@teacher = Teacher.new
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
```
|