For an HTML POST request, after successfully creating the object, response_with redirects the path to the object, i.e. here it will be equivalent to something like
redirect_to Device.create(params[:device])
which is redirected to device_url. But since you have namespaced: devices on your routes, you need to point this to your response_with call, which will
respond_with :api, :v1, Device.create(params[:device])
source share