3 ms·
Also, ORMs do more than replace a SQL statement. They compose together so when you have code like: person.orders.first And you change your database to ma
by 3pt14159 8y ago
Also, ORMs do more than replace a SQL statement. They compose together so when you have code like:
person.orders.first
And you change your database to make an intermediary table when business needs change and you need multiple people to be associated with an order you don't need to change the above line of code, you just call a class method in person and everything continues to work. It only gets more powerful with scopes and other things. I still drop into SQL, but usually when I'm doing data analysis, not normal business logic.
- SahAssar 8y agoWhy not make that a view or a stored procedure instead of keeping it as the ORM layer in the application code?
- Viliam1234 8y agoIf you use this convenient syntax in many places, replacing it with views could result in hundreds of extra views in the database. Then you would have to maintain them whenever something changes.