From 053da92dde6a09eaa9048cdd4b582f53d9e12637 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 25 Oct 2016 13:14:15 +0800 Subject: [PATCH] inline documentation --- app/controllers/synapses_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index 1f4f5b52..c3aed2bc 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -23,6 +23,9 @@ class SynapsesController < ApplicationController @synapse.desc = '' if @synapse.desc.nil? @synapse.desc.strip! # no trailing/leading whitespace + # we want invalid params to return :unprocessable_entity + # so we have to authorize AFTER saving. But if authorize + # fails, we need to rollback the SQL transaction success = nil ActiveRecord::Base.transaction do success = @synapse.save