railsでアプリを作っています
rutes.rb Rails.application.routes.draw do root 'static_pages#home' get '/help', to: 'static_pages#help' get '/about', to: 'static_pages#about' get '/contact', to: 'static_pages#contact' get '/signup', to: 'users#new' post '/signup', to: 'users#create' get '/login', to: 'sessions#new' post '/login', to: 'sessions#create' delete '/logout', to: 'sessions#destroy' resources :users # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end
名前付きルート(help_pathやabout_pathなど)が有効になりません
application.html.erb <body> <header class="navbar navbar-fixed-top navbar-inverse"> <div class="container"> <% flash.each do |message_type, message| %> <div class="alert alert-<%= message_type %>"><%= message %></div> <% end %> <%= link_to " hoge_app", ‘root_path’, id: "logo" %> <nav> <ul class="nav navbar-nav navbar-right"> <li><%= link_to "Home", ‘root_path’ %></li> <li><%= link_to "Help", 'help_path' %></li> <li><%= link_to "Log in", 'login_path’ %></li> <li><%= link_to "About", 'about_’path %></li> </ul> </nav> </div> </header> <div class="container"> <%= yield %> <%= debug(params) if Rails.env.development? %> </div> </body> コード
エッラーコード Routing Error No route matches [GET] "/help_path"
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/12/09 06:00