2013-02-11 126 views
4

我使用紅寶石1.9.2和鋼軌3.我在運行我的應用程序時出現以下錯誤。未定義的方法`symbolize_keys!'爲2:Fixnum

錯誤:

  undefined method `symbolize_keys!' for 2:Fixnum line #606 raised: 

代碼:行號606

  <%= f.text_field :total_amount ,:label=>'Grand Total',:value =>number_with_precision(0,2),:readonly=>true %> 

應用程序跟蹤:

actionpack (3.0.0) lib/action_view/helpers/number_helper.rb:238:in `number_with_precision' 

app/views/cashier/cashier/billing.rhtml:606:in `block (2 levels) in _app_views_cashier_cashier_billing_rhtml__3412897403160140582_59881040__1001215579093570677' 

actionpack (3.0.0) lib/action_view/helpers/capture_helper.rb:39:in `block in capture' 

actionpack (3.0.0) lib/action_view/helpers/capture_helper.rb:171:in `with_output_buffer' 

actionpack (3.0.0) lib/action_view/helpers/capture_helper.rb:39:in `capture' 

請幫我糾正這一錯誤。提前致謝!!!

回答

0

把這裏放在那些不使用Ruby但在使用Ruby編碼的API(如Clock Hotel Software)時看到這個錯誤。我發佈了一個JSON字符串,如{"date":"2013-04-05","value":3},並獲取錯誤。原來我本來應該發佈一個數組:[{"date":"2013-04-05","value":3}]糾正了錯誤。

所以要擴大aisrael的答案,請確保類型你在另一端給程序的東西是預期的。

相關問題