Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

"Models are intended to serve only as an abstraction to the database. They are meant to be 'models of data'."

It's about Ruby or common? Because I'm sure Models could have 0 code of working with database and business-logic only. It depends on architecture of project.



Model classes in Rails inherit ActiveRecord::Base. So, you can call a class method like update_all which is equivalent to an update statement on the table.

'Models could have 0 code of working with database and business-logic only' Well the business logic creeping in is one of the issues here. That is why there are attempts to separate out the business logic as in case of the use of /app/use_cases [refer to the link of use cases in the article].


There's nothing forcing your model classes to inherit ActiveRecord::Base. It's perfectly acceptable to use other ORMs or even bare Ruby classes as models. If the only thing you want to do is database operations, ORM is a waste of time anyway.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: