0
我試圖將導航欄上的thredded/forum路由到鏈接,錯誤阻止了我。不知道它是一個安裝問題還是路徑問題。謝謝!沒有路線匹配{:action =>「show」,:controller =>「forum」}}缺少必需的鍵:[:id]
的routes.rb
Rails.application.routes.draw do
resources :links
mount Thredded::Engine => '/forum' # creates about_path
resources :forum
devise_for :users
root "pages#home"
get "about" => "pages#about"
end
主頁/ _header.html.erb
<nav class="navbar navbar-static-top navbar-default" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= link_to "Rowlund", root_path, class: "navbar-brand" %>
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
</div>
</nav>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Forum", forum_path%></li>
<li><%= link_to "About", about_path %></li>
<% if user_signed_in? %>
<li><%= link_to "Account Settings", edit_user_registration_path %> </li>
<li><%= link_to "Log out", destroy_user_session_path, method: :delete %></li>
<% else %>
<li><%= link_to "Log in", new_user_session_path %></li>
<% end %>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>