3 ms·
When moving from Java to Rails, I tend to think in SQL first, then translate that to Rails' ORM. I didn't really use ORM's in Java, too heavyweight and the sta
by matt_s 9y ago
When moving from Java to Rails, I tend to think in SQL first, then translate that to Rails' ORM. I didn't really use ORM's in Java, too heavyweight and the stack we had was old.
I would go with this approach too - use the ORM until it gets in your way. When the ORM is trying to be 'smart' but ends up having slow queries or N+1 types of things, refactor the code or use raw SQL. Even better is if your ORM lets you use raw SQL in a way where your results are cast into objects.