質問編集履歴

1

schema追加しました

2021/08/13 05:08

投稿

nao0725
nao0725

スコア5

test CHANGED
File without changes
test CHANGED
@@ -20,7 +20,9 @@
20
20
 
21
21
 
22
22
 
23
- ````application_controller.rb
23
+ application_controller.rb
24
+
25
+ ````
24
26
 
25
27
  class ApplicationController < ActionController::Base
26
28
 
@@ -60,88 +62,132 @@
60
62
 
61
63
 
62
64
 
65
+ ```
66
+
67
+
68
+
69
+ sessions/new.html.erb
70
+
71
+ ```
72
+
73
+
74
+
75
+ <div class = "container">
76
+
77
+
78
+
79
+ <h2>Log in</h2>
80
+
81
+
82
+
83
+ <%= form_with model: @user, url: user_session_path, local: true do |f| %>
84
+
85
+
86
+
87
+ <div class="field">
88
+
89
+ <%= f.label :nickname %><br />
90
+
91
+ <%= f.text_field :nickname, autofocus: true, autocomplete: "nickname" %>
92
+
93
+ </div>
94
+
95
+
96
+
97
+ <div class="field">
98
+
99
+ <%= f.label :password %><br />
100
+
101
+ <%= f.password_field :password, autocomplete: "current-password" %>
102
+
103
+ </div>
104
+
105
+
106
+
107
+ <% if devise_mapping.rememberable? %>
108
+
109
+ <div class="field">
110
+
111
+ <%= f.check_box :remember_me %>
112
+
113
+ <%= f.label :remember_me %>
114
+
115
+ </div>
116
+
117
+ <% end %>
118
+
119
+
120
+
121
+ <div class="actions">
122
+
123
+ <%= f.submit "Log in" %>
124
+
125
+ </div>
126
+
127
+ <% end %>
128
+
129
+
130
+
131
+ <%= render "devise/shared/links" %>
132
+
133
+
134
+
135
+ </div>
136
+
137
+ ```
138
+
139
+
140
+
141
+ schema.rb
142
+
143
+ `````
144
+
145
+ create_table "users", force: :cascade do |t|
146
+
147
+ t.string "email", default: "", null: false
148
+
149
+ t.string "encrypted_password", default: "", null: false
150
+
151
+ t.string "reset_password_token"
152
+
153
+ t.datetime "reset_password_sent_at"
154
+
155
+ t.datetime "remember_created_at"
156
+
157
+ t.string "name"
158
+
159
+ t.string "nickname"
160
+
161
+ t.string "profile_image_id"
162
+
163
+ t.string "introduction"
164
+
165
+ t.datetime "created_at", null: false
166
+
167
+ t.datetime "updated_at", null: false
168
+
169
+ t.index ["email"], name: "index_users_on_email", unique: true
170
+
171
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
172
+
173
+ end
174
+
175
+ `````
176
+
177
+
178
+
179
+ 【対策と自分の考え】
180
+
181
+
182
+
183
+ ①下記の記事を参考にsessoins_controllerにもnicknameを追記しましたが、
184
+
185
+ errorの解消ができていない状態です。
186
+
187
+
188
+
63
189
  ````
64
190
 
65
-
66
-
67
- ```sessions/new.html.erb
68
-
69
- <div class = "container">
70
-
71
-
72
-
73
- <h2>Log in</h2>
74
-
75
-
76
-
77
- <%= form_with model: @user, url: user_session_path, local: true do |f| %>
78
-
79
-
80
-
81
- <div class="field">
82
-
83
- <%= f.label :nickname %><br />
84
-
85
- <%= f.text_field :nickname, autofocus: true, autocomplete: "nickname" %>
86
-
87
- </div>
88
-
89
-
90
-
91
- <div class="field">
92
-
93
- <%= f.label :password %><br />
94
-
95
- <%= f.password_field :password, autocomplete: "current-password" %>
96
-
97
- </div>
98
-
99
-
100
-
101
- <% if devise_mapping.rememberable? %>
102
-
103
- <div class="field">
104
-
105
- <%= f.check_box :remember_me %>
106
-
107
- <%= f.label :remember_me %>
108
-
109
- </div>
110
-
111
- <% end %>
112
-
113
-
114
-
115
- <div class="actions">
116
-
117
- <%= f.submit "Log in" %>
118
-
119
- </div>
120
-
121
- <% end %>
122
-
123
-
124
-
125
- <%= render "devise/shared/links" %>
126
-
127
-
128
-
129
- </div>
130
-
131
- ```
132
-
133
-
134
-
135
- 【対策と自分の考え】
136
-
137
- ①下記の記事を参考にsessoins_controllerにもnicknameを追記しましたが、
138
-
139
- errorの解消ができていない状態です。
140
-
141
-
142
-
143
- ````
144
-
145
191
  protected
146
192
 
147
193