Where does business logic go in rails?

后端 未结 4 1323
借酒劲吻你
借酒劲吻你 2021-02-04 09:11

I\'m an ASP.NET MVC developer just starting with my first big project on rails however Im confused as where to put your business logic? on ASP.NET I create a library which conta

4条回答
  •  礼貌的吻别
    2021-02-04 09:35

    I think this blog article provides a good overview of a strategy of incorporating domain driven design with in the rails framework: http://www.smashingboxes.com/domain-logic-in-rails/

    TL;DR

    Refactor your classic rails models into repositories, and use a facade layer in the controllers to interact with your domain model.

    I'm struggling with this a little my self, and as much as the Fat Controller pattern seems to prevail, anything "fat" in software seems to be a smell, violating single responsibility.

提交回复
热议问题