0
我用宝石最好的地方进行编辑讨论主题和评论...它适用于讨论,但注释它给记录未找到错误: 我的路线:
namespace:school do resource:account,:except => [:new,:create,:destroy],:controller =>'account' resources:classes,:path = > “” 做 资源:讨论做 资源:评论 结束 结束 结束使用best_in_place宝石:乌鸦]用户排除错误:#<的ActiveRecord :: RecordNotFound
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)
discussion_controler.rb
def update
@discussion.update_attributes(params[:discussion])
respond_with @discussion
end
comments_controller.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
我可以点击评论和编辑,但不更新:(日志错误:
[乌鸦]用户排除错误:具有ID的ActiveRecord :: RecordNotFound评论= 实际上给讨论ID
谢谢!这样可行 :) – Oatmeal 2013-05-10 08:46:39