开发者

How should I implement business logic layer in Rails? And where should I put that code?

开发者 https://www.devze.com 2023-02-04 09:19 出处:网络
I read \"Enterprise Rails\" (http://oreilly.com/catalog/9780596515201) The author suggests to have two subfolders named logical, physical under the models folder. It sounds like a good idea to organiz

I read "Enterprise Rails" (http://oreilly.com/catalog/9780596515201) The author suggests to have two subfolders named logical, physical under the models folder. It sounds like a good idea to organize the code. It will also allow to have a business layer. I just want to know how rails community feels about this. Is i开发者_如何学Pythont a good idea to have a separate logic layer?


Sometimes I use a "service" layer along the model and controller ones.

I just add it to the autoload_path.

But most of the time, I manage to set the logic into models, or stateless models. So it goes directly into the models folders.

0

精彩评论

暂无评论...
验证码 换一张
取 消