【发布时间】:2015-08-01 02:20:04
【问题描述】:
当我尝试去帖子显示抓取 id 时,我得到一个错误
Rails.application.routes.draw 做 devise_for :用户
资源:帖子做 资源:cmets 结束
根'posts#index'
#this is the show view
.show
%p= @post.content
= link_to "edit", edit_post_path(@post)
= link_to "delete", post_path(@post), method: :delete, data: {confirm: "Are you sure?"}
= link_to "home", root_path
显示控制器
def show
@post = Post.find(params[:id])
end
【问题讨论】:
-
您要重新格式化代码
-
请发布您点击的链接的代码
-
你的模型是什么样的?
-
这就是我点击的内容:%p= link_to post.content, post_path(@posts)
-
这是帖子模型:class Post
标签: ruby-on-rails