Return new transaction on create

This commit is contained in:
benji 2015-09-14 10:32:58 +02:00
parent 54b8e8808b
commit 6c04a90f68

View file

@ -3,6 +3,7 @@ class TransactionsController < ApplicationController
before_action :authenticate_user!, except: :create before_action :authenticate_user!, except: :create
before_action :authenticate_user_or_client!, only: :create before_action :authenticate_user_or_client!, only: :create
respond_to :js, only: :create respond_to :js, only: :create
def create def create
@ -11,7 +12,7 @@ class TransactionsController < ApplicationController
authorize!(:create, @transaction) authorize!(:create, @transaction)
if @transaction.save if @transaction.save
head :created render json: @transaction, status: :created
else else
render json: @transaction.errors.full_messages, render json: @transaction.errors.full_messages,
status: :unprocessable_entity status: :unprocessable_entity