【问题标题】:Using best_in_place gem in 2 level nested controllers: [Raven] User excluded error: #<ActiveRecord::RecordNotFound在 2 级嵌套控制器中使用 best_in_place gem:[Raven] 用户排除错误:#<ActiveRecord::RecordNotFound
【发布时间】:2013-05-10 08:30:40
【问题描述】:

我使用 gem Best In place 来编辑讨论主题和 cmets... 它适用于 Discussion 但对于 Comments 它给出记录未找到错误: 我的路线:
命名空间:学校做 资源 :account, :except => [:new, :create, :destroy], :controller => 'account' 资源 :classes, :path => "" 做 资源:讨论做 资源:cmets 结尾 结尾 结束

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

cmets_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

我可以点击 cmets 并编辑但不更新:( 日志错误:
[Raven] 用户排除错误:ActiveRecord::RecordNotFound 评论 id = 实际上给出了讨论 id

【问题讨论】:

    标签: ruby-on-rails ajax jquery jquery-plugins


    【解决方案1】:

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

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

    = 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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-21
      • 1970-01-01
      • 1970-01-01
      • 2012-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多