0

我使用 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


Could you maybe show us your show contorller action for discussion?

I guess that something like this might solve your problem:

= best_in_place @discussion, :name, :type => :textarea, :path => school_class_discussion_path(params[:class_id], @discussion)
= best_in_place c, :body, :type => :textarea , :path =>school_class_discussion_comment_path(params[:class_id], @discussion, c)
4

1 回答 1

1

您能否向我们展示您的show控制器操作以供讨论?

我想这样的事情可能会解决你的问题:

= best_in_place @discussion, :name, :type => :textarea, :path => school_class_discussion_path(params[:class_id], @discussion)
= best_in_place c, :body, :type => :textarea , :path =>school_class_discussion_comment_path(params[:class_id], @discussion, c)
于 2013-05-10T08:44:10.863 回答