5 ms·
I thought the point of using an ORM like Active Record was to decouple the business logic and the database?
by jklein11 10y ago
I thought the point of using an ORM like Active Record was to decouple the business logic and the database?
- howdopasswordsw 10y agoHAAHHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHAHA!!!!! There is nothing more database-coupling than Active Record. Other ORMs may have decoupling as a goal, however.
- jklein11 10y agoAh that makes sense then. I guess I should have prefaced my comment with the fact that I have little Rails experience.
- oftenwrong 10y agoIt can decouple you from the specific database implementation. The ORM can generate SQL that targets the database you are using by altering the generated queries to account for dialect and feature differences. For example, it can, potentially, make it possible to switch your application from using MySQL to PostgreSQL rather seamlessly. However, in my experience, this is rarely straightforward, and rarely done. It's not unusual for the application layer to become dependent on some quirk or unique feature of the underlying database, and sometimes that dependency is not obvious. The sibling reply is not far off the mark when it comes to using ORMs "in practice".