diff --git a/app/controllers/api/v1/clients_controller.rb b/app/controllers/api/v1/clients_controller.rb index a9ef6fe..72644d9 100644 --- a/app/controllers/api/v1/clients_controller.rb +++ b/app/controllers/api/v1/clients_controller.rb @@ -4,8 +4,12 @@ module Api respond_to :json def create - @client = Client.create(client_params) - respond_with(@client,status: :created) rescue error(409) + @client = Client.new(client_params) + if @client.save + render :json => @client + else + render :json => { :errors => @client.errors.full_messages , :status => 422}.to_json + end end private