前提・実現したいことRouting Error
rails turorialを勉強中です。
5章でログインページを作っているのですが、homeのSign up now!のところをクリックするとrooting errorとなります。
sign up だけでなく、フッターのaboutやcontactをクリックしても同様にエラーが出ます。
No route matches [GET] "/signup_path"
ここに質問の内容を詳しく書いてください。
発生している問題・エラーメッセージ
Routing Error
No route matches [GET] "/signup_path"
Helper HTTP Verb Path Controller#Action
root_path GET / static_pages#home
help_path GET /help(.:format) static_pages#help
about_path GET /about(.:format) static_pages#about
contact_path GET /contact(.:format) static_pages#contact
signup_path GET /signup(.:format) users#new
該当のソースコード
[routes.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'
end
[static_pages_controller.rb]
class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
def contact
end
end
[home.html.erb]
<div class="center jumbotron"> <h1>Welcome to the Sample App</h1> <h2> This is the home page for the <a href="https://railstutorial.jp/">Ruby on Rails Tutorial</a> sample application. </h2><%= link_to "Sign up now!", 'signup_path', class: "btn btn-lg btn-primary" %>
</div>補足情報(FW/ツールのバージョンなど)
cloud9を使用しています。
rails 5.1.4
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/08 14:19