如何在 Rails 中使用 ruby​​ 库?

问题描述:

我刚刚安装了一个 ruby​​ gem

I just installed a ruby gem

 gem install anemone

但我无法直接在我的 rails 应用程序中使用它,这是我第一次使用外部 ruby​​ 库,因此如果您能深入了解它而不仅仅是解决方案,这将非常有帮助

But I cannot hit off to use it directly in my rails application, this is the first time I'm using an external ruby library so it will be very helpful if you can give me an insight into it rather than just a solution

干杯

在你的 Gemfile 添加:

宝石'海葵'

这样 Rails 会在启动时加载库,然后你就可以使用它了.您甚至不必使用 require 关键字.

This way Rails will load the library when it starts, and you can then use it. You don't even have to use the require keyword.