質問編集履歴
1
検索フォームのビュー、検索時のログの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -234,6 +234,86 @@
|
|
234
234
|
|
235
235
|
|
236
236
|
|
237
|
+
###追加情報
|
238
|
+
|
239
|
+
views/layouts/application.html.haml
|
240
|
+
|
241
|
+
```
|
242
|
+
|
243
|
+
%body
|
244
|
+
|
245
|
+
%header.header
|
246
|
+
|
247
|
+
.header__title
|
248
|
+
|
249
|
+
= link_to "Self PR", root_path, class: "header__title--text"
|
250
|
+
|
251
|
+
= form_for(@post, url: posts_searches_path, method: :get, class: "search-form") do |f|
|
252
|
+
|
253
|
+
= f.text_field :keyword, placeholder: "記事を検索する", class: "search-form__input"
|
254
|
+
|
255
|
+
= icon('fas', 'search', class: 'search-icon')
|
256
|
+
|
257
|
+
= f.submit "検索", class: "search-form__btn"
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
.header__right
|
262
|
+
|
263
|
+
- if user_signed_in?
|
264
|
+
|
265
|
+
= link_to current_user.name, user_path(current_user), class: "header__right--btn"
|
266
|
+
|
267
|
+
= link_to "新規投稿", new_post_path, class: "header__right--btn"
|
268
|
+
|
269
|
+
= link_to "ログアウト", destroy_user_session_path, method: :delete, class: "header__right--btn"
|
270
|
+
|
271
|
+
- else
|
272
|
+
|
273
|
+
= link_to "ログイン", new_user_session_path, class: "header__right--btn"
|
274
|
+
|
275
|
+
= link_to "新規登録", new_user_registration_path, class: "header__right--btn"
|
276
|
+
|
277
|
+
= yield
|
278
|
+
|
279
|
+
```
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
`sample`と検索時のターミナルのログ
|
284
|
+
|
285
|
+
```
|
286
|
+
|
287
|
+
Started GET "/posts/searches?utf8=%E2%9C%93&post%5Bkeyword%5D=sample&commit=%E6%A4%9C%E7%B4%A2" for ::1 at 2019-12-14 12:31:19 +0900
|
288
|
+
|
289
|
+
Processing by Posts::SearchesController#index as HTML
|
290
|
+
|
291
|
+
Parameters: {"utf8"=>"✓", "post"=>{"keyword"=>"sample"}, "commit"=>"検索"}
|
292
|
+
|
293
|
+
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 ORDER BY `users`.`id` ASC LIMIT 1
|
294
|
+
|
295
|
+
Rendering posts/searches/index.html.haml within layouts/application
|
296
|
+
|
297
|
+
Post Load (0.2ms) SELECT `posts`.* FROM `posts`
|
298
|
+
|
299
|
+
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1
|
300
|
+
|
301
|
+
Rendered shared/_post.html.haml (5.5ms)
|
302
|
+
|
303
|
+
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1 [["id", 2], ["LIMIT", 1]]
|
304
|
+
|
305
|
+
Rendered shared/_post.html.haml (1.3ms)
|
306
|
+
|
307
|
+
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1 [["id", 2], ["LIMIT", 1]]
|
308
|
+
|
309
|
+
Rendered shared/_post.html.haml (1.7ms)
|
310
|
+
|
311
|
+
Rendered posts/searches/index.html.haml within layouts/application (16.2ms)
|
312
|
+
|
313
|
+
Completed 200 OK in 58ms (Views: 52.6ms | ActiveRecord: 0.7ms)
|
314
|
+
|
315
|
+
```
|
316
|
+
|
237
317
|
|
238
318
|
|
239
319
|
### 補足情報(FW/ツールのバージョンなど)
|