我应该将后端服务代理放在 Rails 中的什么位置?
我的控制器需要通过 HTTParty 与后端服务通信。您会将服务代理类放在哪里?
我想我会为此创建一个 /app/services 文件夹,但我想知道是否有更惯用的东西?
My controller needs to talk to a back-end service via HTTParty. Where would you put that service proxy class?
I was thinking I would create an /app/services folder for this, but I was wondering if there was something more idiomatically appropriate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将我的放在
app/models
中,但如果您愿意,app/services
似乎也合适。I put mine in
app/models
, butapp/services
seems appropriate as well if you prefer.我会将其存储在
lib
文件夹中(可能在lib/services
中?),然后在必要时需要它。我相信这将是存储它的“Rails place”......
I would store it within the
lib
folder (possibly inlib/services
?) and then require it where necessary.I believe this would be the "Rails place" to store it...