<li><%= link_to('More Commented', posts_morecommented_path) %></li>
错误的ActiveRecord :: RecordNotFound在PostsController#显示单击链接
ActiveRecord::RecordNotFound in PostsController#show
Couldn't find Post with id=morecommented
Request
Parameters:
{"id"=>"morecommented"}
我在哪里做的错误?
postscontroller#show动作
def show @post = Post.find(params[:id]) ... end
morecommented.html.erb
<% @moreCommented.each do |t| %>
<%= link_to t.title, :controller => '/posts', :action => 'show', :id => t.id %><br/>
<% end %>
耙路线
post GET /posts/:id(.:format) {:action=>"show", :controller=>"posts"}
....
posts_morecommented /posts/morecommented(.:format) {:controller=>"posts", :action=>"morecommented"}
的routes.rb:
resources :posts
match "posts/:id/categ" => "posts#categ"
match "posts/:id/tag_posts" => "posts#tag_posts"
match "posts/searcharchive" => "posts#searcharchive"
match "posts/morecommented" => "posts#morecommented"
你迁移的数据库? –
添加您的'PostsController#show'动作代码和'routes.rb'或'rake routes'输出 – Bohdan
@MarkW,我为什么要现在迁移数据库?你什么意思 ? – shibly