【问题标题】:Rails problem with humanize人性化的Rails问题
【发布时间】:2011-06-04 22:03:46
【问题描述】:

我正在尝试将作为哈希键的符号人性化

c.each_key{ |f| humanize(f.to_s)}

但由于某种原因,我收到这样的错误

ActionView::Template::Error (undefined method 'humanize' for #<#<Class:0xb5b77a4>:0xb5b6598>)

知道这里出了什么问题吗?

【问题讨论】:

  • 看起来你来自 PHP ;)

标签: ruby ruby-on-rails-3 actionview actionviewhelper


【解决方案1】:

试试这个方法。

c.each_key{ |f| f.to_s.humanize}

【讨论】:

    猜你喜欢
    • 2012-08-16
    • 1970-01-01
    • 2011-04-01
    • 1970-01-01
    • 2015-02-22
    • 1970-01-01
    • 2012-08-10
    • 2011-05-06
    • 2017-03-14
    相关资源
    最近更新 更多