這是我在控制器如何在ruby-on-rails的xml中請求一個頁面?
respond_to do |format|
format.html
format.xml { render :xml => @menus }
end
代碼當我鍵入「http://192.168.210.136:3000」,那麼它呈現HTML版本。
但我該如何請求xml版本?我試過http://192.168.210.136:3000.xml和http://192.168.210.136:3000/index.xml沒有運氣。
謝謝!
沒有測試猜測:http://192.168.210.136: 3000/.xml – Joni 2010-07-17 19:56:12
你的map.root在你的路線文件中看起來像什麼? – Gareth 2010-07-17 19:59:26
@gareth:root:to =>'firstpage#index' – 2010-07-17 21:27:33