我遵循了这个:http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:user_signup。
但是当我尝试访问http://localhost:3000/pages/时,它返回"Routing Error No route matches "/pages"“
这是我的routes.rb
Sample4App::Application.routes.draw do
get "users/new"
match '/signup', :to => 'users#new'
match '/contact', :to => 'pages#contact'
match '/about', :to => 'pages#about'
match '/help', :to => 'pages#help'
match '/', :to => 'pages#home'
end这是我的home.html.erb
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
<%= link_to "Sign up now!", signup_path, :class => "signup_button round" %>我尽我所能了。不过,还是这样。真的需要帮助。谢谢
发布于 2011-08-11 14:21:45
您似乎错过了'/pages/‘的实际路线。尝试将其添加到您的routes.rb
match '/pages' => 'pages#home'发布于 2011-08-11 17:06:39
试试这个:
Sample4App::Application.routes.draw do
get "users/new"
match 'signup' => 'users#new'
match 'contact' => 'pages#contact'
match 'about' => 'pages#about'
match 'help' => 'pages#help'
match 'pages' => 'pages#home'
root :to => 'pages#index'
end并确保您的Pages控制器中有index操作。
发布于 2011-08-11 14:28:06
在根目录中添加以下内容
root :to => 'pages#home'因此,您可以访问http://localhost:3000
或添加
match '/pages', :to => 'pages#home'这样您就可以访问http://localhost:3000/pages
https://stackoverflow.com/questions/7021608
复制相似问题