タイトルの通りRuby on Railsでルートパス
ruby
1Rails.application.routes.draw do 2 # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 3 root "top#index" 4end 5
top/indexになるようにしているのですが
いざアクセスすると
問題のアプリ
user ・・・ user
password ・・・ id
top/indexに飛ばされません。
なので直接URLにパスを指定してみたのですが
このように表示されません。
このアプリにはbasic認証をするため
コントローラーに
ruby
1http_basic_authenticate_with name: "user", password: "id"
が記述されています。
このbasic認証が原因なのかと思い
上記のコードを一回外したのですが
結果は変わりませんでした。
何が原因なのかわかりません。
解決できそうにないのでお願いします。
追記
このアプリにはbasic以外なにも実装していません。
コードを這っておきます。
cmd
1ec2-user:~/environment/basic_app (master) $ rails routes 2 Prefix Verb URI Pattern Controller#Action 3 root GET / ←ここ見るとルートパスが/になっている・・・(原因がつかめない) top#index 4 rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show 5rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show 6 rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show 7update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update 8 rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
ruby
1#コントローラー 2#topコントローラー以外生成していない 3class TopController < ApplicationController 4 http_basic_authenticate_with name: "user", password: "id" 5 6 def index 7 8 end 9end
html
1#top > index.html.erb 2<p>認証成功!</p>
原因として考えられる可能性があるものだけでも
いいのでお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。