How can I pass a variable from a each do to a form_for inside it
I have a <% @user.comments.each do |comment| %>
and inside it is
<%= form_for [????, Subcomment.new],:remote => true do |form| %>
What can I use 开发者_开发知识库at ???? to ensure that the current @user.comment
is passed to the controller?
If I use
<%= form_for [comment, Subcomment.new],:remote => true do |form| %>
I get
No route matches {:controller=>"subcomments", :comment_id=>#<Comment body: "Comments coming up twice", user_id: 2, commenter: "gleb", id: nil>}
If I got your question right, you need to create a hidden field comment_id
精彩评论