From 63ca421f3e77ce2ca96cafc73f8630ddbd0410b0 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 27 Jun 2020 13:05:36 -0500 Subject: [PATCH] comments: fix exception in /comments/new page. Fix regression from 804a2ef9a. --- app/views/comments/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 3144f6cfe..0b643d6b0 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -1,6 +1,6 @@ <%= error_messages_for :comment %> -<%= edit_form_for(comment, namespace: "post_#{comment.post.id}_comment_#{comment.id || "new"}", html: { style: ("display: none;" if local_assigns[:hidden]), class: "edit_comment" }) do |f| %> +<%= edit_form_for(comment, namespace: "post_#{comment&.post_id}_comment_#{comment.id || "new"}", html: { style: ("display: none;" if local_assigns[:hidden]), class: "edit_comment" }) do |f| %> <% if comment.new_record? %> <%= f.hidden_field :post_id %> <% end %>