开发者

Is it possible to put all data access related methods in a separate class?

开发者 https://www.devze.com 2023-01-17 16:15 出处:网络
I like ha开发者_运维技巧ving separate classes, one class represents the entity, and that a separate DAO (database access object).

I like ha开发者_运维技巧ving separate classes, one class represents the entity, and that a separate DAO (database access object).

Is this possible with rails and active record?


Most of what you would put into a DAO is already hidden inside of ActiveRecord anyway, so there's not much of a need to split these up. But, if you insist you can split out whatever methods you want into a separate Module and then include it in your model.

0

精彩评论

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