Home>

I was able to create it before, but when I enter it this time, it returns to the original screen and the following error appears in the terminal.
Speaking of change, in routing,resources: users, only: [: show]Is that we have added controllers and views for them

ActionView :: MissingTemplate (Missing template baggages/new, application/new with {: locale =>[: en],

 : formats =>[: js,: html,: text,: js,: css,: ics,: csv,: vcf,: vtt,: png,: jpeg,: gif,: bmp,: tiff,: svg, : mpeg,: mp3,: ogg,: m4a,: webm,: mp4,: otf,: ttf,: woff,: woff2,: xml,: rss,: atom,: yaml,: multipart_form,: url_encoded_form,: json ,: pdf,: zip,: gzip],

 : variants =>[],

 : handlers =>[: raw,: erb,: html,: builder,: ruby,: coffee,: jbuilder,: haml]}. Searched in:
  * "/ Users/arimotoyuuki/projects/fusion/app/views"
  * "/Users/arimotoyuuki/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/kaminari-core-1.2.0/app/views"
  * "/Users/arimotoyuuki/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/devise-4.7.2/app/views"
):
app/controllers/baggages_controller.rb: 33: in `create'

Controller

class BaggagesController</pre>
<p><br />
routes.rb</p>
<pre><code>Rails.application.routes.draw do
  # get'mypages/index'
  root'pages # index'
  get'pages/show'
  devise_for: users
  resources: baggages
  resources: users, only: [: show]
    namespace: admin do
      resources: baggages do
      end
    end

end

I tried to redirect to root_path, but there is no change

It is a file that was said not to be an error
** app/views/admin/baggages/new.html.haml

.wrapper
  .disply
    = form_with model: @baggage do | f |
      .baggage
        .baggage__box
          % span
            Luggage type
            = f.select: kind, [["Namamono", "Namamono"],

 ["Chilled", "Chilled"],

 ["Frozen", "Frozen"],

 ["Other", "Other"]],

 include_blank: "Please select"
        .baggage__box
          % span
            Storage period
            = f.text_field: storage_period, class: "baggage_text", placeholder:'Example) 7'
            % span days
        .baggage__box
          % span
            Tracking number
            = f.text_field: code, class: "baggage_text", placeholder: '123456789012'
      -# = f.hidden_field: user_id,: value =>"# {user_session}"
      = f.hidden_field: user_id
      = f.submit'SEND', class: "baggage__send"

There is an admin baggages controller with exactly the same description

class Admin :: BaggagesController</pre>
<p><br />
After fixing it, the previous error disappeared, but it was not created, and even if you look at the terminal below, the cause cannot be grasped.</p>
<pre><code>app/controllers/baggages_controller.rb: 34: in `create'
Started POST "/ baggages" for :: 1 at 2020-10-27 08:18:42 +0900
Processing by BaggagesController # create as JS
  Parameters: {"utf8" =>"✓", "authenticity_token" =>"r1DJfXsonsAr8fJOdEzLr7uyluXFz1uBTzK/4P ++ LNRUVBd8jgfp3ZNKbSlAe/I4ausFGKubcmtXmkuVhoHNfw =="," "7", "code" =>"111111111111", "user_id" =>"1"},

 "commit" =>"SEND"}
Unpermitted parameters:: utf8,: authenticity_token,: baggage,: commit
   (0.2ms) BEGIN
  ↳ app/controllers/baggages_controller.rb: 29
   (0.2ms) ROLLBACK
  ↳ app/controllers/baggages_controller.rb: 29
  Rendering baggages/new.html.haml within layouts/application
  Rendered baggages/new.html.haml within layouts/application (8.1ms)
  User Load (0.5ms) SELECT ʻusers`. * FROM ʻusers` WHERE ʻusers` .ʻid` = 2 ORDER BY ʻusers` .ʻid` ASC LIMIT 1
  ↳ app/views/layouts/application.html.haml: 12
Completed 200 OK in 219ms (Views: 173.9ms | ActiveRecord: 21.2ms)
  • Answer # 1

    Conclusion
    Change the strong parameter of class Admin :: BaggagesController and the description of class BaggagesController

    class Admin :: BaggagesController
    class BaggagesController