Hacker News new | ask | show | jobs
by Tainnor 549 days ago
Your business logic should not be tied your persistence, that's what I mean by it.

By "domain objects" I don't mean that you need to embrace OOP, they could be simple structs without any associated logic.

> PPS - N+1 queries are kinda trivial to resolve in most cases in Rails? There's core ORM functionality for it.

The problem isn't that you can't fix N+1 queries in Rails, it's that it's incredibly easy to create them by accident because your ActiveRecord objects carry a DB connection around everywhere, even in views.

1 comments

Ah! Then we're in agreement :)

And yes, Rails makes it easy to make "unthinking" mistakes - like, you should prep your ActiveRecord objects in the controller so they've got all their data for the view, but, because you don't have to...

Blessing and a curse. You can turn it on and pretty much immediately get started, but that doesn't mean you know what you're doing...