简体   繁体   中英

Where do I put back-end service proxies in Rails?

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?

I put mine in app/models , but app/services seems appropriate as well if you prefer.

I would store it within the lib folder (possibly in lib/services ?) and then require it where necessary.

I believe this would be the "Rails place" to store it...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM