在Rails之外使用Rails 3的ActiveSupport核心扩展 [英] Use Rails 3's ActiveSupport core extensions outside rails

查看:161
本文介绍了在Rails之外使用Rails 3的ActiveSupport核心扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用AS 2.3.8工作,但只要我一直在使用AS 2.3.8,我一旦使用ActiveSupport的核心扩展,想要将它移植到3b4,扩展停止工作,并且我的测试结果中充满了如下行:

 未定义方法`blank ?'forsomething:String 

我已经通过 gem activesupport后跟 requireactive_support



还有什么我需要调用以包含这些扩展名?



谢谢

解决方案

ActiveSupport是如果你想要所有active_support的东西,你可以 require'active_support / all'现在。



但是如果你只想要空白?方法,你可以试试 require'active_support / core_ext / string'


I'm having a problem using ActiveSupport's core extensions on a gem I am developing.

I had it working with AS 2.3.8, but as soon as I wanted to port it to 3b4, the extensions stopped working and my test results are filled with lines such as:

undefined method `blank?' for "something":String

I've included it via gem "activesupport" followed by require "active_support"

Is there anything else I need to call to include those extensions?

Thanks

解决方案

ActiveSupport is more separate now in Rails 3.

If you want the all active_support thing, you can require 'active_support/all' now.

But if you want only the blank? method, you can try require 'active_support/core_ext/string'

这篇关于在Rails之外使用Rails 3的ActiveSupport核心扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆