質問編集履歴
5
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
4
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
3
application.jsとGemfileを追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -147,8 +147,103 @@
|
|
147
147
|
↳ app/views/contents/index.html.erb:59
|
148
148
|
Rendered contents/index.html.erb within layouts/application (29.2ms)
|
149
149
|
Completed 200 OK in 119ms (Views: 108.8ms | ActiveRecord: 6.9ms)
|
150
|
-
コード
|
151
150
|
```
|
151
|
+
|
152
|
+
application.js
|
153
|
+
```ここに言語を入力
|
154
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
155
|
+
// listed below.
|
156
|
+
//
|
157
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
|
158
|
+
// vendor/assets/javascripts directory can be referenced here using a relative path.
|
159
|
+
//
|
160
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
161
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
162
|
+
//
|
163
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
164
|
+
// about supported directives.
|
165
|
+
//
|
166
|
+
//= require rails-ujs
|
167
|
+
//= require activestorage
|
168
|
+
//= require turbolinks
|
169
|
+
//= require_tree.
|
170
|
+
//= require jquery
|
171
|
+
//= require popper
|
172
|
+
//= require bootstrap-sprockets
|
173
|
+
|
174
|
+
|
175
|
+
// 検索バー contents/index
|
176
|
+
document.addEventListener("touchstart", function () { }, true);
|
177
|
+
```
|
178
|
+
|
179
|
+
Gemfile
|
180
|
+
```ここに言語を入力
|
181
|
+
source 'https://rubygems.org'
|
182
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
183
|
+
|
184
|
+
ruby '2.5.1'
|
185
|
+
|
186
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
187
|
+
gem 'rails', '~> 5.2.4', '>= 5.2.4.2'
|
188
|
+
# Use postgresql as the database for Active Record
|
189
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
190
|
+
# Use Puma as the app server
|
191
|
+
gem 'puma', '~> 3.11'
|
192
|
+
# Use SCSS for stylesheets
|
193
|
+
gem 'sass-rails', '~> 5.0'
|
194
|
+
# Use Uglifier as compressor for JavaScript assets
|
195
|
+
gem 'uglifier', '>= 1.3.0'
|
196
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
197
|
+
# gem 'mini_racer', platforms: :ruby
|
198
|
+
|
199
|
+
# Use CoffeeScript for .coffee assets and views
|
200
|
+
gem 'coffee-rails', '~> 4.2'
|
201
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
202
|
+
gem 'turbolinks', '~> 5'
|
203
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
204
|
+
gem 'jbuilder', '~> 2.5'
|
205
|
+
# Use Redis adapter to run Action Cable in production
|
206
|
+
# gem 'redis', '~> 4.0'
|
207
|
+
# Use ActiveModel has_secure_password
|
208
|
+
# gem 'bcrypt', '~> 3.1.7'
|
209
|
+
|
210
|
+
# Use ActiveStorage variant
|
211
|
+
# gem 'mini_magick', '~> 4.8'
|
212
|
+
|
213
|
+
# Use Capistrano for deployment
|
214
|
+
# gem 'capistrano-rails', group: :development
|
215
|
+
|
216
|
+
# Reduces boot times through caching; required in config/boot.rb
|
217
|
+
gem 'bootsnap', '>= 1.1.0', require: false
|
218
|
+
|
219
|
+
group :development, :test do
|
220
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
221
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
222
|
+
end
|
223
|
+
|
224
|
+
group :development do
|
225
|
+
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
226
|
+
gem 'web-console', '>= 3.3.0'
|
227
|
+
gem 'listen', '>= 3.0.5', '< 3.2'
|
228
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
229
|
+
gem 'spring'
|
230
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
231
|
+
end
|
232
|
+
|
233
|
+
group :test do
|
234
|
+
# Adds support for Capybara system testing and selenium driver
|
235
|
+
gem 'capybara', '>= 2.15'
|
236
|
+
gem 'selenium-webdriver'
|
237
|
+
# Easy installation and use of chromedriver to run system tests with Chrome
|
238
|
+
gem 'chromedriver-helper'
|
239
|
+
end
|
240
|
+
|
241
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
242
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
243
|
+
gem 'bootstrap'
|
244
|
+
gem "jquery-rails"
|
245
|
+
gem 'inline_svg'
|
246
|
+
```
|
152
247
|
### 試したこと
|
153
248
|
turbolinksを切ったりもしましたが、挙動は変化がありませんでした。
|
154
249
|
原因特定が出来ず調べるにも困難しています。
|
2
ログの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -111,6 +111,44 @@
|
|
111
111
|
resources :contents
|
112
112
|
delete "contents" => "contents#select_destroy"
|
113
113
|
```
|
114
|
+
|
115
|
+
ターミナル上のサーバーログ
|
116
|
+
```tarted DELETE "/contents" for ::1 at 2020-05-21 12:38:00 +0900
|
117
|
+
Processing by ContentsController#select_destroy as JS
|
118
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"2K/5lDMPFkaUeG9IXkEbHxj5nhxhj8wtyxNSGP2MqrKiZVVB5f9CZ6BJPsUCy1EcMk1XFN73IZ4qis08BF/tcg==", "content"=>{"content_ids"=>["133", "136"]}}
|
119
|
+
Content Load (0.8ms) SELECT "contents".* FROM "contents" WHERE "contents"."id" = $1 LIMIT $2 [["id", 133], ["LIMIT", 1]]
|
120
|
+
↳ app/controllers/contents_controller.rb:40
|
121
|
+
(0.2ms) BEGIN
|
122
|
+
↳ app/controllers/contents_controller.rb:41
|
123
|
+
Content Destroy (0.3ms) DELETE FROM "contents" WHERE "contents"."id" = $1 [["id", 133]]
|
124
|
+
↳ app/controllers/contents_controller.rb:41
|
125
|
+
(1.3ms) COMMIT
|
126
|
+
↳ app/controllers/contents_controller.rb:41
|
127
|
+
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]]
|
128
|
+
↳ app/controllers/contents_controller.rb:41
|
129
|
+
Content Load (0.6ms) SELECT "contents".* FROM "contents" WHERE "contents"."id" = $1 LIMIT $2 [["id", 136], ["LIMIT", 1]]
|
130
|
+
↳ app/controllers/contents_controller.rb:40
|
131
|
+
(0.2ms) BEGIN
|
132
|
+
↳ app/controllers/contents_controller.rb:41
|
133
|
+
Content Destroy (0.3ms) DELETE FROM "contents" WHERE "contents"."id" = $1 [["id", 136]]
|
134
|
+
↳ app/controllers/contents_controller.rb:41
|
135
|
+
(1.1ms) COMMIT
|
136
|
+
↳ app/controllers/contents_controller.rb:41
|
137
|
+
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]]
|
138
|
+
↳ app/controllers/contents_controller.rb:41
|
139
|
+
Redirected to http://localhost:3000/contents
|
140
|
+
Completed 200 OK in 23ms (ActiveRecord: 6.1ms)
|
141
|
+
|
142
|
+
|
143
|
+
Started GET "/contents" for ::1 at 2020-05-21 12:38:00 +0900
|
144
|
+
Processing by ContentsController#index as HTML
|
145
|
+
Rendering contents/index.html.erb within layouts/application
|
146
|
+
Content Load (6.9ms) SELECT "contents".* FROM "contents"
|
147
|
+
↳ app/views/contents/index.html.erb:59
|
148
|
+
Rendered contents/index.html.erb within layouts/application (29.2ms)
|
149
|
+
Completed 200 OK in 119ms (Views: 108.8ms | ActiveRecord: 6.9ms)
|
150
|
+
コード
|
151
|
+
```
|
114
152
|
### 試したこと
|
115
153
|
turbolinksを切ったりもしましたが、挙動は変化がありませんでした。
|
116
154
|
原因特定が出来ず調べるにも困難しています。
|
1
インデントの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,29 +18,29 @@
|
|
18
18
|
### 該当のソースコード
|
19
19
|
**index.html.erb**
|
20
20
|
```ここに言語名を入力
|
21
|
-
|
21
|
+
<%= form_with model: @contents, url: contents_path, method: :delete do |f| %>
|
22
|
-
|
22
|
+
<% @contents.each do |content| %>
|
23
|
-
|
23
|
+
<% @count += 1%>
|
24
|
-
|
24
|
+
<tr>
|
25
|
-
|
25
|
+
<td>
|
26
|
-
|
26
|
+
<%= f.check_box :content_ids, {type: 'checkbox', class: 'checkbox-select', id: "checkbox#{@count}", multiple: true, include_hidden: false}, content.id %>
|
27
|
-
|
27
|
+
<%= f.label :'', for: "checkbox#{@count}",class: 'select-label' %>
|
28
|
-
|
28
|
+
</td>
|
29
|
-
|
29
|
+
<td> <%= link_to content.name, content %> </td>
|
30
|
-
|
30
|
+
<td> <%= link_to 'URL', content.url %> </td>
|
31
|
-
|
31
|
+
<%#概要は空白の場合の処理も記載%>
|
32
|
-
|
32
|
+
<td><%= link_to content.description.blank? ? 'None' : content.description, content %></td>
|
33
33
|
|
34
34
|
|
35
|
-
|
35
|
+
<%#カテゴリーは空白の場合の処理も記載%>
|
36
|
-
|
36
|
+
<td><%= link_to content.category.blank? ? 'None' : content.category, content %></td>
|
37
|
-
|
37
|
+
<td><%= link_to content.updated_at.to_s(:datetime_jp), content %></td>
|
38
|
-
|
38
|
+
</tr>
|
39
|
-
|
39
|
+
<% end %>
|
40
|
-
|
40
|
+
<%= f.button contents_path, data_toggle: 'tooltip', data_placement: 'topdo', title: '削除',data: {confirm: "ブックマークを削除します", turbolinks: false},class: 'select_submit' do %>
|
41
|
-
|
41
|
+
<%= embedded_svg('delete.svg', class: "delete")%>
|
42
|
-
|
42
|
+
<% end %>
|
43
|
-
|
43
|
+
<% end %>
|
44
44
|
```
|
45
45
|
**contents_controller.rb**
|
46
46
|
|