Rails Model, View, Controller, and Helper: what goes where?

后端 未结 10 992
不思量自难忘°
不思量自难忘° 2020-11-30 15:59

In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic.

Please answer in the affirmative - With Do put this h

10条回答
  •  抹茶落季
    2020-11-30 16:43

    Testing, Testing ... Put as much logic as possible in the model and then you will be able to test it properly. Unit tests test the data and the way it is formed by testing the model, and functional tests test the way it is routed or controlled by testing the controllers, so it follows that you can't test the integrity of the data unless it is in the model.

    j

提交回复
热议问题