Where does business logic go in rails?

后端 未结 4 1325
借酒劲吻你
借酒劲吻你 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:46

    You can put business logic anywhere you want (even in views! though that's a bad idea).

    I'd say if the logic is tied to a real-world object, then put it on the model. Otherwise, use the controller. But it's up to you to determine how to do it for your app. Models are for modeling things, and Controllers are for controlling things.

提交回复
热议问题