我正在尝试为我的应用构建一个评论系统,当我尝试为博客帖子创建评论时,我遇到了这个语法错误。
blog/app/controllers/comments_controller.rb:86: syntax error, unexpected $end, expecting keyword_end
end
这就是我对评论控制器的看法
def create
@article = Article.find(params[:article_id])
@comment = @article.comments.build(params[:comment])
respond_to do |format|
if @comment.save
format.html { redirect_to(@article, :notice => 'Comment was successfully created.') }
format.xml { render :xml => @article, :status => :created, :location => @article }
else
format.html { redirect_to(@article, :notice =>
'Comment could not be saved. Please fill in all fields')}
format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }
end
end
end
我试图删除一个结尾,但这没有帮助。
我正在运行rails 3.0.9和ruby 1.9.2