質問編集履歴

4

誤字

2019/06/11 16:46

投稿

tomtom1
tomtom1

スコア168

test CHANGED
File without changes
test CHANGED
@@ -210,11 +210,9 @@
210
210
 
211
211
  *destory時
212
212
 
213
- app/views/likes/create.js.erb:1:in `_app_views_likes_create_js_erb___3843924283153595975_70276136979320'
214
-
215
- Started POST "/likes/3/create" for 127.0.0.1 at 2019-06-12 01:18:54 +0900
213
+ Started POST "/likes/3/destroy" for 127.0.0.1 at 2019-06-12 01:45:42 +0900
216
-
214
+
217
- Processing by LikesController#create as JS
215
+ Processing by LikesController#destroy as JS
218
216
 
219
217
  Parameters: {"post_id"=>"3"}
220
218
 
@@ -222,31 +220,27 @@
222
220
 
223
221
  ↳ app/controllers/application_controller.rb:6
224
222
 
225
- (0.1ms) begin transaction
226
-
227
- ↳ app/controllers/likes_controller.rb:7
228
-
229
- CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
230
-
231
- ↳ app/controllers/likes_controller.rb:7
232
-
233
- Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT ? [["id", 3], ["LIMIT", 1]]
234
-
235
- ↳ app/controllers/likes_controller.rb:7
236
-
237
- Like Create (0.3ms) INSERT INTO "likes" ("user_id", "post_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["user_id", 1], ["post_id", 3], ["created_at", "2019-06-11 16:18:54.762800"], ["updated_at", "2019-06-11 16:18:54.762800"]]
238
-
239
- ↳ app/controllers/likes_controller.rb:7
240
-
241
- (9.0ms) commit transaction
242
-
243
- ↳ app/controllers/likes_controller.rb:7
244
-
245
- Rendering likes/create.js.erb
246
-
247
- Rendered likes/create.js.erb (421.1ms)
248
-
249
- Completed 500 Internal Server Error in 489ms (ActiveRecord: 9.7ms)
223
+ Like Load (0.1ms) SELECT "likes".* FROM "likes" WHERE "likes"."user_id" = ? AND "likes"."post_id" = ? LIMIT ? [["user_id", 1], ["post_id", 3], ["LIMIT", 1]]
224
+
225
+ ↳ app/controllers/likes_controller.rb:12
226
+
227
+ (0.0ms) begin transaction
228
+
229
+ ↳ app/controllers/likes_controller.rb:13
230
+
231
+ Like Destroy (0.2ms) DELETE FROM "likes" WHERE "likes"."id" = ? [["id", 16]]
232
+
233
+ ↳ app/controllers/likes_controller.rb:13
234
+
235
+ (9.3ms) commit transaction
236
+
237
+ ↳ app/controllers/likes_controller.rb:13
238
+
239
+ Rendering likes/destroy.js.erb
240
+
241
+ Rendered likes/destroy.js.erb (344.0ms)
242
+
243
+ Completed 500 Internal Server Error in 401ms (ActiveRecord: 9.9ms)
250
244
 
251
245
 
252
246
 
@@ -254,12 +248,12 @@
254
248
 
255
249
 
256
250
 
257
- ActionView::Template::Error (undefined local variable or method `post' for #<#<Class:0x00007fd4ddb6d190>:0x00007fd4da1f3f90>):
251
+ ActionView::Template::Error (undefined local variable or method `post' for #<#<Class:0x00007fd4ddb6d190>:0x00007fd4e100c900>):
258
252
 
259
253
  1: $('#likes_buttons_<%= post.id %>').html("<%= j(render partial: 'likes/like', locals: {post: post}) %>");
260
254
 
261
255
 
262
256
 
263
- app/views/likes/create.js.erb:1:in `_app_views_likes_create_js_erb___3843924283153595975_70276134472580'
257
+ app/views/likes/destroy.js.erb:1:in `_app_views_likes_destroy_js_erb___3195171927017731297_70276142362720'
264
-
258
+
265
- ```
259
+ ```

3

追記

2019/06/11 16:46

投稿

tomtom1
tomtom1

スコア168

test CHANGED
File without changes
test CHANGED
@@ -151,3 +151,115 @@
151
151
  gem 'jquery-ui-rails'
152
152
 
153
153
  ```
154
+
155
+ ```Error
156
+
157
+ *post時
158
+
159
+ Started POST "/likes/3/create" for 127.0.0.1 at 2019-06-12 01:17:20 +0900
160
+
161
+ Processing by LikesController#create as JS
162
+
163
+ Parameters: {"post_id"=>"3"}
164
+
165
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
166
+
167
+ ↳ app/controllers/application_controller.rb:6
168
+
169
+ (0.1ms) begin transaction
170
+
171
+ ↳ app/controllers/likes_controller.rb:7
172
+
173
+ CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
174
+
175
+ ↳ app/controllers/likes_controller.rb:7
176
+
177
+ Post Load (0.2ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT ? [["id", 3], ["LIMIT", 1]]
178
+
179
+ ↳ app/controllers/likes_controller.rb:7
180
+
181
+ Like Create (0.3ms) INSERT INTO "likes" ("user_id", "post_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["user_id", 1], ["post_id", 3], ["created_at", "2019-06-11 16:17:20.936859"], ["updated_at", "2019-06-11 16:17:20.936859"]]
182
+
183
+ ↳ app/controllers/likes_controller.rb:7
184
+
185
+ (9.2ms) commit transaction
186
+
187
+ ↳ app/controllers/likes_controller.rb:7
188
+
189
+ Rendering likes/create.js.erb
190
+
191
+ Rendered likes/create.js.erb (341.5ms)
192
+
193
+ Completed 500 Internal Server Error in 406ms (ActiveRecord: 10.0ms)
194
+
195
+
196
+
197
+ ActionView::Template::Error (undefined local variable or method `post' for #<#<Class:0x00007fd4ddb6d190>:0x00007fd4e05c8db8>):
198
+
199
+ 1: $('#likes_buttons_<%= post.id %>').html("<%= j(render partial: 'likes/like', locals: {post: post}) %>");
200
+
201
+
202
+
203
+ app/views/likes/create.js.erb:1:in `_app_views_likes_create_js_erb___3843924283153595975_70276136979320'
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ *destory時
212
+
213
+ app/views/likes/create.js.erb:1:in `_app_views_likes_create_js_erb___3843924283153595975_70276136979320'
214
+
215
+ Started POST "/likes/3/create" for 127.0.0.1 at 2019-06-12 01:18:54 +0900
216
+
217
+ Processing by LikesController#create as JS
218
+
219
+ Parameters: {"post_id"=>"3"}
220
+
221
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
222
+
223
+ ↳ app/controllers/application_controller.rb:6
224
+
225
+ (0.1ms) begin transaction
226
+
227
+ ↳ app/controllers/likes_controller.rb:7
228
+
229
+ CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
230
+
231
+ ↳ app/controllers/likes_controller.rb:7
232
+
233
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT ? [["id", 3], ["LIMIT", 1]]
234
+
235
+ ↳ app/controllers/likes_controller.rb:7
236
+
237
+ Like Create (0.3ms) INSERT INTO "likes" ("user_id", "post_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["user_id", 1], ["post_id", 3], ["created_at", "2019-06-11 16:18:54.762800"], ["updated_at", "2019-06-11 16:18:54.762800"]]
238
+
239
+ ↳ app/controllers/likes_controller.rb:7
240
+
241
+ (9.0ms) commit transaction
242
+
243
+ ↳ app/controllers/likes_controller.rb:7
244
+
245
+ Rendering likes/create.js.erb
246
+
247
+ Rendered likes/create.js.erb (421.1ms)
248
+
249
+ Completed 500 Internal Server Error in 489ms (ActiveRecord: 9.7ms)
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+ ActionView::Template::Error (undefined local variable or method `post' for #<#<Class:0x00007fd4ddb6d190>:0x00007fd4da1f3f90>):
258
+
259
+ 1: $('#likes_buttons_<%= post.id %>').html("<%= j(render partial: 'likes/like', locals: {post: post}) %>");
260
+
261
+
262
+
263
+ app/views/likes/create.js.erb:1:in `_app_views_likes_create_js_erb___3843924283153595975_70276134472580'
264
+
265
+ ```

2

追記

2019/06/11 16:20

投稿

tomtom1
tomtom1

スコア168

test CHANGED
File without changes
test CHANGED
@@ -121,3 +121,33 @@
121
121
  couldn't find file 'jquery' with type 'application/javascript'
122
122
 
123
123
  ```
124
+
125
+
126
+
127
+ ###修正/追加後
128
+
129
+ ```js
130
+
131
+ application.js
132
+
133
+ //= require rails-ujs
134
+
135
+ //= require jquery
136
+
137
+ //= require jquery_ujs
138
+
139
+ //= require activestorage
140
+
141
+ //= require turbolinks
142
+
143
+ //= require_tree .
144
+
145
+ ```
146
+
147
+ ```gem
148
+
149
+ gem 'jquery-rails'
150
+
151
+ gem 'jquery-ui-rails'
152
+
153
+ ```

1

誤字

2019/06/11 15:13

投稿

tomtom1
tomtom1

スコア168

test CHANGED
File without changes
test CHANGED
@@ -54,7 +54,7 @@
54
54
 
55
55
  *create.js.erb
56
56
 
57
- $('#likes_buttons_<%= post.id %>').html("<%= j(render partial: 'likes/like', locals: {post: post}) %>");
57
+ $('#likes_buttons_<%= post.id %>').html("<%= j(render partial: 'likes/like', locals: {post: post}) %>");
58
58
 
59
59
  ```
60
60
 
@@ -62,7 +62,7 @@
62
62
 
63
63
  *destroy.js.erb
64
64
 
65
- $('#likes_buttons_<%= blog.id %>').html("<%= j(render partial: 'likes/like', locals: {post: post}) %>");
65
+ $('#likes_buttons_<%= post.id %>').html("<%= j(render partial: 'likes/like', locals: {post: post}) %>");
66
66
 
67
67
  ```
68
68