def show
#find parent call_flow
@call_flow = CallFlow.where('dnis' => params[:dnis]).first
if @call_flow.nil?
@response = ["no result"]
else
#find first routable options (should be a message)
@call_flow_options = @call_flow.routable_type.constantize.find(@call_flow.routable_id).options
#if there is a route after the first route, find it
unless @call_flow_options.first.target_routable_type.nil?
@target_routable = @call_flow_options.first.target_routable_type.constantize.find(@call_flow_options.first.target_routable_id).options
@call_flow_options.to_a.push(@target_routable.to_a)
end
@response = @call_flow.to_a.push(@call_flow_options)
end
respond_with @response
end
我收回数据但浏览器无法将其识别为JSON,因为所有"
双引号都替换为"
。
答案 0 :(得分:2)
如果您希望整个响应都是JSON(而不是使用JSON的HTML / JavaScript),您可以这样做:
render :json => @response