<%= form_for(@feedback) do |f| %> <%= render partial: 'form_errors', locals: { what: @feedback } %> <% if @feedback.new_record? %> <%# When submitting new feedback (as opposed to an update), the order_id parameter is required. Updates don't need to specify order_id. %> <%= f.hidden_field(:order_id) %>
<%end%> <%# Updates can only modify the text message, not the rating. Can't remember the exact reasons for designing it this way. Maybe reason is to prevent someone changing historical positive feedback to negative based on a single bad sale. %>
<%= f.label :feedback %> <%= f.text_area :feedback, rows: 5, class: 'form-control' %>
<%= f.submit class: 'btn btn-primary' %>
<% end %>