0
def convert_vend_types_param
if params[:schedule_machine][:vend_types].present?
vend_types = []
params[:schedule_machine][:vend_types].each_pair do |vt, active|
vend_types << vt.to_sym if active.to_i > 0
end
params[:schedule_machine][:vend_types] = vend_types
end
end
api :PUT, "/v1/schedules/:schedule_id/schedule_machines/:id", "Update a schedule machine"
param_group :schedule_machine
error :code => 422
def update
convert_vend_types_param
if params[:schedule_machine]
if params[:schedule_machine][:products_returned_at]
new_date = params[:schedule_machine][:products_returned_at]
if @schedule_machine.products_returned_at == nil || new_date.to_date > @schedule_machine.products_returned_at.to_date
ScheduleMachineProductCounterJob.new.async.perform(@schedule_machine.id)
end
end
end
unless @schedule_machine.update_attributes(params[:schedule_machine])
render(json: { error: 'Invalid schedule machine information' }, status: :unprocessable_entity) and return
end
render :show
end
내 요청 및 타임 아웃 :이 간단한 PUT 요청이 시간 초과되는 이유는 무엇입니까?
2015-01-13T17:52:06.437358+00:00 app[web.1]: Parameters: {"token"=>"mytoken", "schedule_machine"=>{"remove_verified_at"=>"2015-01-13"}, "schedule_id"=>"58", "schedule_location_id"=>"2178", "id"=>"4874"}
2015-01-13T17:52:06.437292+00:00 app[web.1]: Processing by Api::V1::ScheduleMachinesController#update as JSON
2015-01-13T17:52:07.441605+00:00 app[web.1]: Rendered api/v1/schedule_machines/show.json.rabl (740.3ms)
2015-01-13T17:52:10.681136+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=PUT path="/api/v1/schedules/58/schedule_locations/2178/schedule_machines/4874.json" host=myapp.herokuapp.com request_id=1e4ea64a-8552-4e5d-8580-3c2a8d04ec49 fwd="107.77.72.114" dyno=web.1 connect=2ms service=30001ms status=503 bytes=0
이 경우 비동기 작업이 발생하지 않아야합니다. 모델 속성을 업데이트하는 중입니다. – quantumpotato
트리거 할 수있는 콜백이 있습니까? –