Is it possible to put all data access related methods in a separate class?
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.
精彩评论