converted to render json
This commit is contained in:
parent
f48adef361
commit
925aae4f01
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue