DEV Community

Discussion on: Refactoring Tip: Use the View Object pattern in Rails for building a user profile page

Collapse
 
toommz profile image
Thomas

One thing that always made me uncomfortable with this pattern is that it almost always forward SQL read requests to the view. It’s during the rendering of your partial / template that the methods are called.

How do you handle this in production @github? Eager loading in the controller won’t help here because scopes always fire an SQL request I guess.

But the pattern is great, used it multiple times and will use it again. Great article πŸ‘πŸΌ