Ruby on rails 设计和布线错误

Ruby on rails 设计和布线错误,ruby-on-rails,devise,Ruby On Rails,Devise,我正在使用Desive对用户进行身份验证,并在注册和登录页面上出现以下错误 No route matches {:action=>"search", :controller=>"devise/home"} 很明显是因为 <%= link_to "Search", url_for(:controller => "home", :action => "search") 发件人: 使用旧款时要小心 参数样式,作为额外的文字 需要哈希: link_到“Articles”

我正在使用Desive对用户进行身份验证,并在注册和登录页面上出现以下错误

No route matches {:action=>"search", :controller=>"devise/home"}
很明显是因为

<%= link_to "Search", url_for(:controller => "home", :action => "search")
发件人:

使用旧款时要小心 参数样式,作为额外的文字 需要哈希:

link_到“Articles”,{:controller=>“Articles”},:id=>“news”,:class=>“article”
# =>  
去掉散列会给出错误的结果 链接:

链接到“错误!”,:controller=>“articles”,:id=>“news”,:class=>“article”
# => 

“最好”使用上述链接中所述的命名资源路由,这样,如果资源路由发生更改,您就不必手动更新链接。

快速而肮脏的修复方法是在控制器名称、url_之前添加斜杠(:controller=>“/home”,:action=>“search”)。另一种方法是使用资源路由。
get "home/search"
devise_for :users
root :to => "home#index"
link_to "Articles", { :controller => "articles" }, :id => "news", :class => "article"
# => <a href="/articles" class="article" id="news">Articles</a> 
link_to "WRONG!", :controller => "articles", :id => "news", :class => "article"
# => <a href="/articles/index/news?class=article">WRONG!</a>