值考慮下面的代碼:測試在哈希
params = {:async => true, :contact_id => "101"}
puts "async is #{params['async']}"
if params['async'] == true
puts "Do async stuff"
# TODO Launch background task
return [204, {}, ['']]
end
爲什麼我從來沒有得到過線"Do async stuff"
當我看到輸出"async is true"
?
是的,班級是字符串。謝謝! –
我按照你的帖子回答。如果有''true'',則寫爲'params [:async] =='true''。 –