没有路线符合[GET]“ / static_pages / home”

时间:2018-09-13 14:08:46

标签: ruby-on-rails

我是初学者。 我遇到麻烦了,因为我无法解决错误。

错误消息

没有路线与[GET]“ / static_pages / home”匹配

Rails.root:/ home / ec2-user / environment / sample_app

应用程序跟踪|框架跟踪完整跟踪

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

sample_app / config / 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'
end

layout / application.html.erb

<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag    'application', media: 'all',
'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application',
'data-turbolinks-track': 'reload' %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>

layout / 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!", '#', class: "btn btn-lg btn-primary" %>
</div>

<%= link_to image_tag("rails.png", alt: "Rails logo"),
'http://rubyonrails.org/' %>

0 个答案:

没有答案