传递link_to的变量ID时出现此错误。我无法读取该变量在接下来的页面(blog_details.html.erb)无法通过链接传递ID
错误:
ActiveRecord::RecordNotFound in HomeController#blog_details
Couldn't find Post without an ID
我的家控制器:
class HomeController < ApplicationController
def blog
@posts = Post.all
end
def blog_details
@post = Post.find(params[:id])
end
end
我与变量链接:
<div class="post-title">
<h2 class="title">
<%= link_to (post.titulo), :controller => 'home',
:action => 'blog_details', :post_id => post.id %>
</h2>
</div>
有人可以帮我解决这个错误吗?
谢谢你。工作 – user1211674 2013-03-03 18:47:59