我正在为 Rails 开发一个私有(private) gem,其中包含一个 Controller 助手。
我怀疑这个助手在这两个地方之间:
lib/gem_name/my_helper.rb
app/controllers/concerns/gem_name/my_helper.rb
它的正确位置是什么?
最佳答案
我认为你应该在 Controller concern
中使用它,然后将辅助模块包含到应用程序 Controller 中
所以我更喜欢 app/controllers/concerns/gem_name/my_helper.rb
在 gem 中创建 Controller 助手。
关于ruby-on-rails - rails gem : correct place for a controller helper?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49491152/