尝试编辑帖子时收到错误消息:
帖子#编辑控制器:
def edit
@post = Post.find params[:id]
end
帖子#更新控制器:
def update
@post = Post.find params[:post]
if @post.update_attributes params[:post]
redirect_to posts_path
else
render 'edit'
end
end
编辑视图:
h1 Edit Post
= form_for @post do |f|
p
= f.label :title
= f.text_field :title
p
br
p
= f.label :content
= f.text_area :content
p
br
p
= f.submit 'Update Post'
p
br
这是我在 PostsController#update, Unknown Key: 标题错误中得到 ArgumentError 的时候。我仍在思考 Rails 4 中的强参数概念,所以它可能与此有关……有什么想法吗?