error msg is not working
tho068 opened this issue · comments
I have tried rendering it like this:
render :json => "{'errors' : #{@device.errors.to_json}", status: :unprocessable_entity
and
render :json => "{'errors' : #{@device.errors.to_json}}", status: :unprocessable_entity
and
render :json => @device.errors, status: :unprocessable_entity
All of these gives an error in the javascript console, saying that response.responseJSON is undefined, and error msgs does not render.
soved it by using this
render json: {errors: @device.errors}, status: :unprocessable_entity