ActiveSupport::Ramaze 项目中的 Inflector?

发布于 2024-10-03 09:23:26 字数 212 浏览 0 评论 0原文

我刚刚升级到 ActiveSupport 3,丢失了所有字符串方法,例如“camelize”、“titleize”等。它破坏了我整个项目的一切,到目前为止,我已经通过自己重写这些方法来修复它们,但必须有更好的方法。我确实意识到 ActiveSupport 不再在全局范围内修补 String 可能是一件好事,但是,它对我来说非常有用。无论如何,我可以将这些东西修补回字符串上,或者找到一种新的方式来调用它们吗?

I just upgraded to ActiveSupport 3 and lost all my string methods like "camelize", "titleize", and the like. It broke things all over my project, and so far I've fixed them by re-writing those methods myself, but there has to be a better way. I do realize that it's probably a good thing that ActiveSupport no longer monkey patches String globally, but, it was working great for me. Is there anyway I can patch these things back onto string, of find a new way to call them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素衣风尘叹 2024-10-10 09:23:26

您可能正在这样做:

require 'active_support'

这需要非常非常基础的主动支持。

你想要的是这样的:

require 'active_support/core_ext/string'

You're probably doing this:

require 'active_support'

Which requires the very, very basics of Active Support.

What you want is this:

require 'active_support/core_ext/string'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文