converted to render json
This commit is contained in:
parent
f48adef361
commit
925aae4f01
|
@ -4,8 +4,12 @@ module Api
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@client = Client.create(client_params)
|
@client = Client.new(client_params)
|
||||||
respond_with(@client,status: :created) rescue error(409)
|
if @client.save
|
||||||
|
render :json => @client
|
||||||
|
else
|
||||||
|
render :json => { :errors => @client.errors.full_messages , :status => 422}.to_json
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue