如何从 gem 配置 Rails 3.1 应用程序?

发布于 2024-12-09 00:12:19 字数 212 浏览 3 评论 0原文

例如,当我需要应用 gem 时,我想更改 Rails 设置。

如果我只是将这一行

Rails.application.config.assets.prefix = '/app/themes/default/assets'

放入我的 gem 中,则不会更改设置。我想我需要在那里使用一些导轨挂钩。

请帮助我伙计们

For example, I want to change rails settings when I require my gem to application.

If I simply put this line

Rails.application.config.assets.prefix = '/app/themes/default/assets'

into my gem, this does not change the settings. I think I need to use some rails hooks there.

Please help me guys

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

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

发布评论

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

评论(1

慕烟庭风 2024-12-16 00:12:19

您不需要配置资产的路径。当放置在正确的位置时,它们应该会自动加载。您需要定义一个“引擎”。看看我制作的 gem:https://github.com/iain/formalize-rails

You shouldn't need to configure the path of the assets. When put in the proper place, they should load automatically. You need to define an "Engine". Have a look at a gem I made: https://github.com/iain/formalize-rails

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