質問編集履歴
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -29,9 +29,8 @@
|
|
29
29
|
お力を貸していただけると嬉しいです
|
30
30
|
|
31
31
|
追記
|
32
|
-
```
|
32
|
+
```ここに言語を入力
|
33
|
-
$ rake routes
|
34
|
-
|
33
|
+
Prefix Verb URI Pattern Controller#Action
|
35
34
|
teachers_new GET /teachers/new(.:format) teachers#new
|
36
35
|
new_teacher_session GET /teachers/sign_in(.:format) devise/sessions#new
|
37
36
|
teacher_session POST /teachers/sign_in(.:format) devise/sessions#create
|
@@ -48,12 +47,59 @@
|
|
48
47
|
PUT /teachers(.:format) devise/registrations#update
|
49
48
|
DELETE /teachers(.:format) devise/registrations#destroy
|
50
49
|
POST /teachers(.:format) devise/registrations#create
|
50
|
+
teachers GET /teachers(.:format) teachers#index
|
51
|
+
POST /teachers(.:format) teachers#create
|
52
|
+
new_teacher GET /teachers/new(.:format) teachers#new
|
53
|
+
edit_teacher GET /teachers/:id/edit(.:format) teachers#edit
|
54
|
+
teacher GET /teachers/:id(.:format) teachers#show
|
55
|
+
PATCH /teachers/:id(.:format) teachers#update
|
56
|
+
PUT /teachers/:id(.:format) teachers#update
|
57
|
+
DELETE /teachers/:id(.:format) teachers#destroy
|
58
|
+
new_student_session GET /students/sign_in(.:format) devise/sessions#new
|
59
|
+
student_session POST /students/sign_in(.:format) devise/sessions#create
|
60
|
+
destroy_student_session DELETE /students/sign_out(.:format) devise/sessions#destroy
|
61
|
+
new_student_password GET /students/password/new(.:format) devise/passwords#new
|
62
|
+
edit_student_password GET /students/password/edit(.:format) devise/passwords#edit
|
63
|
+
student_password PATCH /students/password(.:format) devise/passwords#update
|
64
|
+
PUT /students/password(.:format) devise/passwords#update
|
65
|
+
POST /students/password(.:format) devise/passwords#create
|
66
|
+
cancel_student_registration GET /students/cancel(.:format) devise/registrations#cancel
|
67
|
+
new_student_registration GET /students/sign_up(.:format) devise/registrations#new
|
68
|
+
edit_student_registration GET /students/edit(.:format) devise/registrations#edit
|
69
|
+
student_registration PATCH /students(.:format) devise/registrations#update
|
70
|
+
PUT /students(.:format) devise/registrations#update
|
71
|
+
DELETE /students(.:format) devise/registrations#destroy
|
72
|
+
POST /students(.:format) devise/registrations#create
|
73
|
+
home_top GET /home/top(.:format) home#top
|
74
|
+
root GET / home#top
|
51
75
|
```
|
52
76
|
```ruby
|
53
77
|
class TeachersController < ApplicationController
|
54
78
|
def new
|
55
79
|
@teacher = Teacher.new
|
56
80
|
end
|
81
|
+
def create
|
82
|
+
@teacher = Teacher.new(teacher_params)
|
83
|
+
@teacher.save
|
84
|
+
redirect_to teachers_path #リダイレクト先はご自由に設定しましょう。
|
85
|
+
end
|
86
|
+
|
87
|
+
def edit
|
88
|
+
@teacher = Teacher.find(id: params[:id])
|
89
|
+
@teacher.save
|
90
|
+
redirect_to teachers_path
|
91
|
+
end
|
57
92
|
|
58
93
|
end
|
94
|
+
```
|
95
|
+
```ruby
|
96
|
+
Rails.application.routes.draw do
|
97
|
+
get 'teachers/new'
|
98
|
+
devise_for :teachers
|
99
|
+
resources :teachers
|
100
|
+
devise_for :students
|
101
|
+
get 'home/top'
|
102
|
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.htm
|
103
|
+
root to: "home#top"
|
104
|
+
|
59
105
|
```
|
2
書式の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
|
14
14
|
一応調べてみたところ、他の人の解決方法で次のようにどこに飛ばせば良いのかかけば良いとありますが、
|
15
15
|
この仕組み(:urlからの記述の意味)がよくわかっておりません><
|
16
|
+
(以下の記述は私が作るものとは無関係のものです)
|
16
17
|
```ここに言語を入力
|
17
18
|
<%= form_for @profile,:url => {:action => :update} do |p| %>
|
18
19
|
<p>学校名</p>
|
@@ -53,5 +54,6 @@
|
|
53
54
|
def new
|
54
55
|
@teacher = Teacher.new
|
55
56
|
end
|
57
|
+
|
56
58
|
end
|
57
59
|
```
|
1
rake routesの記述、コントローラーの記述
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,4 +25,33 @@
|
|
25
25
|
<% end %>
|
26
26
|
```
|
27
27
|
|
28
|
-
お力を貸していただけると嬉しいです
|
28
|
+
お力を貸していただけると嬉しいです
|
29
|
+
|
30
|
+
追記
|
31
|
+
```ruby
|
32
|
+
$ rake routes
|
33
|
+
Prefix Verb URI Pattern Controller#Action
|
34
|
+
teachers_new GET /teachers/new(.:format) teachers#new
|
35
|
+
new_teacher_session GET /teachers/sign_in(.:format) devise/sessions#new
|
36
|
+
teacher_session POST /teachers/sign_in(.:format) devise/sessions#create
|
37
|
+
destroy_teacher_session DELETE /teachers/sign_out(.:format) devise/sessions#destroy
|
38
|
+
new_teacher_password GET /teachers/password/new(.:format) devise/passwords#new
|
39
|
+
edit_teacher_password GET /teachers/password/edit(.:format) devise/passwords#edit
|
40
|
+
teacher_password PATCH /teachers/password(.:format) devise/passwords#update
|
41
|
+
PUT /teachers/password(.:format) devise/passwords#update
|
42
|
+
POST /teachers/password(.:format) devise/passwords#create
|
43
|
+
cancel_teacher_registration GET /teachers/cancel(.:format) devise/registrations#cancel
|
44
|
+
new_teacher_registration GET /teachers/sign_up(.:format) devise/registrations#new
|
45
|
+
edit_teacher_registration GET /teachers/edit(.:format) devise/registrations#edit
|
46
|
+
teacher_registration PATCH /teachers(.:format) devise/registrations#update
|
47
|
+
PUT /teachers(.:format) devise/registrations#update
|
48
|
+
DELETE /teachers(.:format) devise/registrations#destroy
|
49
|
+
POST /teachers(.:format) devise/registrations#create
|
50
|
+
```
|
51
|
+
```ruby
|
52
|
+
class TeachersController < ApplicationController
|
53
|
+
def new
|
54
|
+
@teacher = Teacher.new
|
55
|
+
end
|
56
|
+
end
|
57
|
+
```
|