Form có nhiều biến trong rails
Mình có tuỳ chỉnh form comment như sau
# comments/_form.html.erb
<%= form_for(comment, event), html: {class: "form-inline"} do |form| %>
  <% if comment.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
      <ul>
      <% comment.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
  <div class="form-group" style="width:100%">
      <%= form.hidden_field :user_id, value: current_user.id %>
      <%= form.hidden_field :event_id, value: event.id %>
      <%= form.text_area :content, rows: 1, :class => "comment-box form-control", :style=>"width:50%",
          :required => true, :autocomplete => 'off', placeholder: "Comment" %>
          
      <%= form.submit "Comment", id: "reply_submit", class: "btn btn-primary" %>
  </div>
<% end %>
Và sau đó render lại
# events/show.html.erb
        <%= render partial: "comments/form", locals: { event: @event, comment: @comment } %>
Hiện tại thì liên tục xảy ra lỗi. Xin được mọi ngừoi giúp đỡ. Đây là ảnh lỗi và log


Link git và nhánh: https://github.com/BlazingRockStorm/let-us-go/tree/make-comment-component
2 CÂU TRẢ LỜI
Bạn thử sửa như này xem sao
<%= form_for [comment, event], html: {class: "form-inline"} do |form| %>
à mình đổi lại khá ok rồi. nhưng mà lại có vấn đề mới là giờ comment 1 phát là tự dưng lại download. mã 204 no content. Mình đang không biết nên xử lý ở file nào và ra sao cả.
@devil_boom_129 Mình nghĩ do bạn thiếu controller xử lý route này /comments/:comment_id/events, hoặc là controller không return gì cả. Bạn có thể tham khảo thêm https://guides.rubyonrails.org/routing.html#nested-resources
nó ghi viết nhầm syntax kìa tự nhiên lòi cái html...
form_for(comment, event), html: {class: "form-inline"}
em sửa theo gợi ý của 1 anh trong group RoR vẫn dữ nguyên có sao đâu ạ
@devil_boom_129 nguyên ls đc, e để cái dấu dóng mở ngoặc thế kia là đã kết thúc hàm rồi, or phải đổi giống bạn bên trên chứ. 
 
  
  
  
 