質問編集履歴
5
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
4
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
3
application.jsとGemfileを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -296,10 +296,200 @@
|
|
296
296
|
|
297
297
|
Completed 200 OK in 119ms (Views: 108.8ms | ActiveRecord: 6.9ms)
|
298
298
|
|
299
|
-
コード
|
300
|
-
|
301
299
|
```
|
302
300
|
|
301
|
+
|
302
|
+
|
303
|
+
application.js
|
304
|
+
|
305
|
+
```ここに言語を入力
|
306
|
+
|
307
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
308
|
+
|
309
|
+
// listed below.
|
310
|
+
|
311
|
+
//
|
312
|
+
|
313
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
|
314
|
+
|
315
|
+
// vendor/assets/javascripts directory can be referenced here using a relative path.
|
316
|
+
|
317
|
+
//
|
318
|
+
|
319
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
320
|
+
|
321
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
322
|
+
|
323
|
+
//
|
324
|
+
|
325
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
326
|
+
|
327
|
+
// about supported directives.
|
328
|
+
|
329
|
+
//
|
330
|
+
|
331
|
+
//= require rails-ujs
|
332
|
+
|
333
|
+
//= require activestorage
|
334
|
+
|
335
|
+
//= require turbolinks
|
336
|
+
|
337
|
+
//= require_tree.
|
338
|
+
|
339
|
+
//= require jquery
|
340
|
+
|
341
|
+
//= require popper
|
342
|
+
|
343
|
+
//= require bootstrap-sprockets
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
// 検索バー contents/index
|
350
|
+
|
351
|
+
document.addEventListener("touchstart", function () { }, true);
|
352
|
+
|
353
|
+
```
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
Gemfile
|
358
|
+
|
359
|
+
```ここに言語を入力
|
360
|
+
|
361
|
+
source 'https://rubygems.org'
|
362
|
+
|
363
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
ruby '2.5.1'
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
372
|
+
|
373
|
+
gem 'rails', '~> 5.2.4', '>= 5.2.4.2'
|
374
|
+
|
375
|
+
# Use postgresql as the database for Active Record
|
376
|
+
|
377
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
378
|
+
|
379
|
+
# Use Puma as the app server
|
380
|
+
|
381
|
+
gem 'puma', '~> 3.11'
|
382
|
+
|
383
|
+
# Use SCSS for stylesheets
|
384
|
+
|
385
|
+
gem 'sass-rails', '~> 5.0'
|
386
|
+
|
387
|
+
# Use Uglifier as compressor for JavaScript assets
|
388
|
+
|
389
|
+
gem 'uglifier', '>= 1.3.0'
|
390
|
+
|
391
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
392
|
+
|
393
|
+
# gem 'mini_racer', platforms: :ruby
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
# Use CoffeeScript for .coffee assets and views
|
398
|
+
|
399
|
+
gem 'coffee-rails', '~> 4.2'
|
400
|
+
|
401
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
402
|
+
|
403
|
+
gem 'turbolinks', '~> 5'
|
404
|
+
|
405
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
406
|
+
|
407
|
+
gem 'jbuilder', '~> 2.5'
|
408
|
+
|
409
|
+
# Use Redis adapter to run Action Cable in production
|
410
|
+
|
411
|
+
# gem 'redis', '~> 4.0'
|
412
|
+
|
413
|
+
# Use ActiveModel has_secure_password
|
414
|
+
|
415
|
+
# gem 'bcrypt', '~> 3.1.7'
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
# Use ActiveStorage variant
|
420
|
+
|
421
|
+
# gem 'mini_magick', '~> 4.8'
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
# Use Capistrano for deployment
|
426
|
+
|
427
|
+
# gem 'capistrano-rails', group: :development
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
# Reduces boot times through caching; required in config/boot.rb
|
432
|
+
|
433
|
+
gem 'bootsnap', '>= 1.1.0', require: false
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
group :development, :test do
|
438
|
+
|
439
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
440
|
+
|
441
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
442
|
+
|
443
|
+
end
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
group :development do
|
448
|
+
|
449
|
+
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
450
|
+
|
451
|
+
gem 'web-console', '>= 3.3.0'
|
452
|
+
|
453
|
+
gem 'listen', '>= 3.0.5', '< 3.2'
|
454
|
+
|
455
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
456
|
+
|
457
|
+
gem 'spring'
|
458
|
+
|
459
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
460
|
+
|
461
|
+
end
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
group :test do
|
466
|
+
|
467
|
+
# Adds support for Capybara system testing and selenium driver
|
468
|
+
|
469
|
+
gem 'capybara', '>= 2.15'
|
470
|
+
|
471
|
+
gem 'selenium-webdriver'
|
472
|
+
|
473
|
+
# Easy installation and use of chromedriver to run system tests with Chrome
|
474
|
+
|
475
|
+
gem 'chromedriver-helper'
|
476
|
+
|
477
|
+
end
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
482
|
+
|
483
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
484
|
+
|
485
|
+
gem 'bootstrap'
|
486
|
+
|
487
|
+
gem "jquery-rails"
|
488
|
+
|
489
|
+
gem 'inline_svg'
|
490
|
+
|
491
|
+
```
|
492
|
+
|
303
493
|
### 試したこと
|
304
494
|
|
305
495
|
turbolinksを切ったりもしましたが、挙動は変化がありませんでした。
|
2
ログの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -224,6 +224,82 @@
|
|
224
224
|
|
225
225
|
```
|
226
226
|
|
227
|
+
|
228
|
+
|
229
|
+
ターミナル上のサーバーログ
|
230
|
+
|
231
|
+
```tarted DELETE "/contents" for ::1 at 2020-05-21 12:38:00 +0900
|
232
|
+
|
233
|
+
Processing by ContentsController#select_destroy as JS
|
234
|
+
|
235
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"2K/5lDMPFkaUeG9IXkEbHxj5nhxhj8wtyxNSGP2MqrKiZVVB5f9CZ6BJPsUCy1EcMk1XFN73IZ4qis08BF/tcg==", "content"=>{"content_ids"=>["133", "136"]}}
|
236
|
+
|
237
|
+
Content Load (0.8ms) SELECT "contents".* FROM "contents" WHERE "contents"."id" = $1 LIMIT $2 [["id", 133], ["LIMIT", 1]]
|
238
|
+
|
239
|
+
↳ app/controllers/contents_controller.rb:40
|
240
|
+
|
241
|
+
(0.2ms) BEGIN
|
242
|
+
|
243
|
+
↳ app/controllers/contents_controller.rb:41
|
244
|
+
|
245
|
+
Content Destroy (0.3ms) DELETE FROM "contents" WHERE "contents"."id" = $1 [["id", 133]]
|
246
|
+
|
247
|
+
↳ app/controllers/contents_controller.rb:41
|
248
|
+
|
249
|
+
(1.3ms) COMMIT
|
250
|
+
|
251
|
+
↳ app/controllers/contents_controller.rb:41
|
252
|
+
|
253
|
+
ActiveStorage::Attachment Load (1.0ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4 [["record_id", 133], ["record_type", "Content"], ["name", "image"], ["LIMIT", 1]]
|
254
|
+
|
255
|
+
↳ app/controllers/contents_controller.rb:41
|
256
|
+
|
257
|
+
Content Load (0.6ms) SELECT "contents".* FROM "contents" WHERE "contents"."id" = $1 LIMIT $2 [["id", 136], ["LIMIT", 1]]
|
258
|
+
|
259
|
+
↳ app/controllers/contents_controller.rb:40
|
260
|
+
|
261
|
+
(0.2ms) BEGIN
|
262
|
+
|
263
|
+
↳ app/controllers/contents_controller.rb:41
|
264
|
+
|
265
|
+
Content Destroy (0.3ms) DELETE FROM "contents" WHERE "contents"."id" = $1 [["id", 136]]
|
266
|
+
|
267
|
+
↳ app/controllers/contents_controller.rb:41
|
268
|
+
|
269
|
+
(1.1ms) COMMIT
|
270
|
+
|
271
|
+
↳ app/controllers/contents_controller.rb:41
|
272
|
+
|
273
|
+
ActiveStorage::Attachment Load (0.3ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4 [["record_id", 136], ["record_type", "Content"], ["name", "image"], ["LIMIT", 1]]
|
274
|
+
|
275
|
+
↳ app/controllers/contents_controller.rb:41
|
276
|
+
|
277
|
+
Redirected to http://localhost:3000/contents
|
278
|
+
|
279
|
+
Completed 200 OK in 23ms (ActiveRecord: 6.1ms)
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
Started GET "/contents" for ::1 at 2020-05-21 12:38:00 +0900
|
286
|
+
|
287
|
+
Processing by ContentsController#index as HTML
|
288
|
+
|
289
|
+
Rendering contents/index.html.erb within layouts/application
|
290
|
+
|
291
|
+
Content Load (6.9ms) SELECT "contents".* FROM "contents"
|
292
|
+
|
293
|
+
↳ app/views/contents/index.html.erb:59
|
294
|
+
|
295
|
+
Rendered contents/index.html.erb within layouts/application (29.2ms)
|
296
|
+
|
297
|
+
Completed 200 OK in 119ms (Views: 108.8ms | ActiveRecord: 6.9ms)
|
298
|
+
|
299
|
+
コード
|
300
|
+
|
301
|
+
```
|
302
|
+
|
227
303
|
### 試したこと
|
228
304
|
|
229
305
|
turbolinksを切ったりもしましたが、挙動は変化がありませんでした。
|
1
インデントの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,51 +38,51 @@
|
|
38
38
|
|
39
39
|
```ここに言語名を入力
|
40
40
|
|
41
|
-
|
41
|
+
<%= form_with model: @contents, url: contents_path, method: :delete do |f| %>
|
42
|
-
|
42
|
+
|
43
|
-
|
43
|
+
<% @contents.each do |content| %>
|
44
|
-
|
44
|
+
|
45
|
-
|
45
|
+
<% @count += 1%>
|
46
|
-
|
46
|
+
|
47
|
-
|
47
|
+
<tr>
|
48
|
-
|
48
|
+
|
49
|
-
|
49
|
+
<td>
|
50
|
-
|
50
|
+
|
51
|
-
|
51
|
+
<%= f.check_box :content_ids, {type: 'checkbox', class: 'checkbox-select', id: "checkbox#{@count}", multiple: true, include_hidden: false}, content.id %>
|
52
|
-
|
52
|
+
|
53
|
-
|
53
|
+
<%= f.label :'', for: "checkbox#{@count}",class: 'select-label' %>
|
54
|
-
|
54
|
+
|
55
|
-
|
55
|
+
</td>
|
56
|
-
|
56
|
+
|
57
|
-
|
57
|
+
<td> <%= link_to content.name, content %> </td>
|
58
|
-
|
58
|
+
|
59
|
-
|
59
|
+
<td> <%= link_to 'URL', content.url %> </td>
|
60
|
-
|
60
|
+
|
61
|
-
|
61
|
+
<%#概要は空白の場合の処理も記載%>
|
62
|
-
|
62
|
+
|
63
|
-
|
63
|
+
<td><%= link_to content.description.blank? ? 'None' : content.description, content %></td>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
-
|
69
|
+
<%#カテゴリーは空白の場合の処理も記載%>
|
70
|
-
|
70
|
+
|
71
|
-
|
71
|
+
<td><%= link_to content.category.blank? ? 'None' : content.category, content %></td>
|
72
|
-
|
72
|
+
|
73
|
-
|
73
|
+
<td><%= link_to content.updated_at.to_s(:datetime_jp), content %></td>
|
74
|
-
|
74
|
+
|
75
|
-
|
75
|
+
</tr>
|
76
|
-
|
76
|
+
|
77
|
-
|
77
|
+
<% end %>
|
78
|
-
|
78
|
+
|
79
|
-
|
79
|
+
<%= f.button contents_path, data_toggle: 'tooltip', data_placement: 'topdo', title: '削除',data: {confirm: "ブックマークを削除します", turbolinks: false},class: 'select_submit' do %>
|
80
|
-
|
80
|
+
|
81
|
-
|
81
|
+
<%= embedded_svg('delete.svg', class: "delete")%>
|
82
|
-
|
82
|
+
|
83
|
-
|
83
|
+
<% end %>
|
84
|
-
|
84
|
+
|
85
|
-
|
85
|
+
<% end %>
|
86
86
|
|
87
87
|
```
|
88
88
|
|