現在の状況
現在ローカルでrailsアプリを作成中
ウィザード形式のユーザー登録に挑戦しています。
その中で、 routes.rbに記載していないURIパターンが出て困っております。
ご教授頂けないでしょうか。
routes.rb
ruby
1Rails.application.routes.draw do 2 devise_for :users, controllers: { 3 sessions: 'users/sessions', 4 registrations: 'users/registrations' 5 } 6 devise_scope :user do 7 get '/profileaddresses', to: 'users/registrations#new_profileaddresses' 8 post '/profileaddresses', to: 'users/registrations#create_profileaddresses' 9 get '/deliveryaddresses',to: 'users/registrations#new_deliveryaddresses' 10 post '/deliveryaddresses', to: 'users/registrations#create_deliveryaddresses' 11 end 12 13 root to: 'products#index' 14 resources :mypages, only: [:index] do 15 collection do 16 get 'logout' 17 get 'card' 18 get 'newcard' 19 end 20 end 21 22 resources :products, only: [:index, :new, :edit, :show] 23end
rails routes
Prefix Verb URI Pattern Controller#Action new_user_session GET /users/sign_in(.:format) users/sessions#new user_session POST /users/sign_in(.:format) users/sessions#create destroy_user_session DELETE /users/sign_out(.:format) users/sessions#destroy new_user_password GET /users/password/new(.:format) devise/passwords#new edit_user_password GET /users/password/edit(.:format) devise/passwords#edit user_password PATCH /users/password(.:format) devise/passwords#update PUT /users/password(.:format) devise/passwords#update POST /users/password(.:format) devise/passwords#create cancel_user_registration GET /users/cancel(.:format) users/registrations#cancel new_user_registration GET /users/sign_up(.:format) users/registrations#new edit_user_registration GET /users/edit(.:format) users/registrations#edit user_registration PATCH /users(.:format) users/registrations#update PUT /users(.:format) users/registrations#update DELETE /users(.:format) users/registrations#destroy POST /users(.:format) users/registrations#create profileaddresses GET /profileaddresses(.:format) users/registrations#new_profileaddresses POST /profileaddresses(.:format) users/registrations#create_profileaddresses deliveryaddresses GET /deliveryaddresses(.:format) users/registrations#new_deliveryaddresses POST /deliveryaddresses(.:format) users/registrations#create_deliveryaddresses root GET / products#index logout_mypages GET /mypages/logout(.:format) mypages#logout card_mypages GET /mypages/card(.:format) mypages#card newcard_mypages GET /mypages/newcard(.:format) mypages#newcard mypages GET /mypages(.:format) mypages#index products GET /products(.:format) products#index new_product GET /products/new(.:format) products#new edit_product GET /products/:id/edit(.:format) products#edit product GET /products/:id(.:format) products#show rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
これによって困っていること
本当なら、viewの順番としてsinup→(get)profileaddresses→(get)deliveryaddressesなるはずが、この/users.userによってsinup→(get)/users.user(中身はprofileaddressesのview)→(get)profileaddresses→(get)deliveryaddresses→(get)deliveryaddressesという状態で、最後のviewが二回現れる現象が起きております。
自分の考え
自分の考えでは、devise_scope :user doの:userが関係しているのではと思っているのですが、どう直せばいいのか検索しても分かりません。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。