ruby-on-rails – 未定义的方法`symbolize_keys!’ 2:Fixnum
发布时间:2020-12-17 03:54:52 所属栏目:百科 来源:网络整理
导读:我正在使用 ruby 1.9.2和rails 3.运行我的应用程序时出现以下错误. 错误: 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),:re
我正在使用
ruby 1.9.2和rails 3.运行我的应用程序时出现以下错误.
错误: 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' 请帮我纠正这个错误.提前致谢!!! 解决方法
number_with_precision期望第二个参数是选项哈希
http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#method-i-number_with_precision 通常,每当你看到“未定义的方法’symbolize_keys!’”时,它意味着你传递了Ruby / Rails期望Hash的其他一些对象或值. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |