diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 1ebe316..0b1f1c9 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -12,7 +12,7 @@ @answer = nil # if defined within the transaction block, was not accessable afterward # ensure user has access to plan BEFORE creating/finding answer rails Pundit::NotAuthorizedError unless Plan.find(plan_id).readable_by?(@note.user_id) - Answer.transaction do + Answer.transaction do if params[:note][:answer_id].present? @answer = Answer.find(params[:note][:answer_id]) end