我使用 gem Best In place 来编辑讨论主题和评论......它适用于讨论,但对于评论它给出了未找到记录的错误:我的路线:
命名空间:学校做资源:帐户,:except => [:新,: create, :destroy], :controller => 'account' 资源 :classes, :path => "" 做资源 :discussions 做资源 :comments end end end
show.html.haml(讨论)
= best_in_place @discussion, :name, :type => :textarea, :path => school_class_discussion_path
= best_in_place c, :body, :type => :textarea , :path =>school_class_discussion_comment_path(params[:class_id], @discussion)
讨论控制器.rb
def update
@discussion.update_attributes(params[:discussion])
respond_with @discussion
end
评论控制器.rb
def update
@comment = Comment.find(params[:id])
@comment.update_attributes(params[:comment])
respond_with @comment , :location => school_class_discussion_comment_path(params[:class_id], @discussion))
end
我可以点击评论和编辑但不更新:( 日志错误:
[Raven] 用户排除错误:ActiveRecord::RecordNotFound comment with id =实际上给出了讨论 id