質問編集履歴

2

resources :baggages, only: [:new, :show]をresources :baggages, only: [:new,:create, :show]に変更

2020/10/16 11:05

投稿

yukireonsousi
yukireonsousi

スコア3

test CHANGED
File without changes
test CHANGED
@@ -326,7 +326,7 @@
326
326
 
327
327
 
328
328
 
329
- resources :baggages, only: [:new, :show]
329
+ resources :baggages, only: [:new,:create, :show]
330
330
 
331
331
  namespace :admin do
332
332
 

1

エラー文とルーティングのコードの追加

2020/10/16 11:05

投稿

yukireonsousi
yukireonsousi

スコア3

test CHANGED
File without changes
test CHANGED
@@ -227,3 +227,131 @@
227
227
  = f.submit 'SEND', class: "baggage__send"
228
228
 
229
229
  ```
230
+
231
+ エラー文
232
+
233
+ ```
234
+
235
+ NoMethodError in Admin::Baggages#new
236
+
237
+ Showing /Users/arimotoyuuki/projects/fusion/app/views/admin/baggages/new.html.haml where line #4 raised:
238
+
239
+
240
+
241
+ undefined method `baggages_path' for #<#<Class:0x00007fb0d88e2f48>:0x00007fb0ef5a1390>
242
+
243
+ Did you mean? baggage_path
244
+
245
+ Extracted source (around line #4):
246
+
247
+ 2
248
+
249
+ 3
250
+
251
+ 4
252
+
253
+ 5
254
+
255
+ 6
256
+
257
+ 7
258
+
259
+
260
+
261
+
262
+
263
+ .disply
264
+
265
+ = form_with model: @baggage do |f|
266
+
267
+
268
+
269
+ .baggage
270
+
271
+ .baggage__box
272
+
273
+
274
+
275
+ Rails.root: /Users/arimotoyuuki/projects/fusion
276
+
277
+
278
+
279
+ Application Trace | Framework Trace | Full Trace
280
+
281
+ app/views/admin/baggages/new.html.haml:4:in `_app_views_admin_baggages_new_html_haml___1924533726690858305_70198953314620'
282
+
283
+ Request
284
+
285
+ Parameters:
286
+
287
+
288
+
289
+ {"user_id"=>"1"}
290
+
291
+ Toggle session dump
292
+
293
+ Toggle env dump
294
+
295
+ Response
296
+
297
+ Headers:
298
+
299
+
300
+
301
+ None
302
+
303
+ x
304
+
305
+ >> params
306
+
307
+ => <ActionController::Parameters {"user_id"=>"1", "controller"=>"admin/baggages", "action"=>"new"} permitted: false>
308
+
309
+ >>
310
+
311
+ ```
312
+
313
+ **routes.rb**
314
+
315
+ ```
316
+
317
+ Rails.application.routes.draw do
318
+
319
+
320
+
321
+ root 'pages#index'
322
+
323
+ get 'pages/show'
324
+
325
+ devise_for :users
326
+
327
+
328
+
329
+ resources :baggages, only: [:new, :show]
330
+
331
+ namespace :admin do
332
+
333
+ resources :baggages do
334
+
335
+ collection do
336
+
337
+ get 'search'
338
+
339
+ end
340
+
341
+ end
342
+
343
+ end
344
+
345
+
346
+
347
+ end
348
+
349
+ ```
350
+
351
+ ```
352
+
353
+ get 'search'
354
+
355
+ ```
356
+
357
+ は使ってないから、削除した方がいいかもしれないですね