title: How can I rollback a rails save/transaction?
body: <p>In my controller I have some code like...</p>
  
  <pre><code>...
  if user.save
      something = Something.where("thing = ?", thing)
      if !(something.nil?)
          render json: { something: something }
      else
          #I WOULD LIKE TO ROLLBACK THE user.save HERE
      end
  else
      render json: { error: user.errors.full_messages }, status: :bad_request
  end
  </code></pre>
  
  <p>I have tried</p>
  
  <pre><code>raise ActiveRecord::Rollback, "Could not create new User, Something was not found."
  render json: { error: "Could not create new User, Something was not found"}, status: :unprocessable_entity
  </code></pre>
  
  <p>in place of the ROLLBACK COMMENT area above, but this does not work. The user.save ends up going through. It spits something out to 'rails s', but it does not rollback the last transaction.</p>