在rails 4的索引中包含ajax注释

在rails 4的索引中包含ajax注释,ajax,ruby-on-rails-4,solr,comments,Ajax,Ruby On Rails 4,Solr,Comments,我的rails应用程序中有ajax注释,所有这些都可以在帖子中使用,但我想添加表单以在索引页面中呈现注释 我在呈现索引页面时使用sorl,并尝试在post模型中包含注释,如下所示: searchable(:include => :comments) do code.... end <%= simple_form_for Comment.build_from(post, current_user, ""), :url => comments_path, :remot

我的rails应用程序中有ajax注释,所有这些都可以在帖子中使用,但我想添加表单以在索引页面中呈现注释

我在呈现索引页面时使用sorl,并尝试在post模型中包含注释,如下所示:

searchable(:include => :comments) do

  code....

end
<%= simple_form_for Comment.build_from(post, current_user, ""), :url => comments_path,   :remote => true do |f| %>
但这不会在索引页面中呈现帖子下方的评论,即使我在视图中有这样的评论

 <%= render :partial => 'comments/comment',:collection => @comments,  :as => :comment %>
财务主任评论:

评论模式:


评论表应如下所示:

searchable(:include => :comments) do

  code....

end
<%= simple_form_for Comment.build_from(post, current_user, ""), :url => comments_path,   :remote => true do |f| %>
我必须为注释分配当前的post-id-commentable\u id和commentable\u类型的当前用户id来构建注释

在视图中,要呈现我使用的注释

<%= render post.comment_threads.order('created_at desc') %>
唯一的问题是渲染忽略了div

<%= simple_form_for Comment.build_from(post, current_user, ""), :url => comments_path,   :remote => true do |f| %>
<%= render post.comment_threads.order('created_at desc') %>