1
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。Rails的控制器將返回轉義JSON
是什麼反應的問題的一部分是什麼樣子? – tadman
https://gist.github.com/4501bb7379b6e4d91ba5 –