I have a common situation and would like best practice suggestions from
of you more experienced rails developers.
In my DB I’ve normalized tables in a traditional manner, e.g. I have
which have authors stored in a Users table.
My problem is when I go to show a list of Posts and I want to display
author name (e.g. post.author.name)
ActiveRecord appears to do a SELECT on the Users table for each post.
want to display additional author properties
(e.g. phone_number), additional queries are generated. Clearly this is
performance penalty for my normalization.
What’s the recommended way for avoiding the performance penalty WITHOUT
In C# or Java I’d cache the “static” User data and do in-memory lookups,
in Rails I’m not sure how I’d set up such a cache
even if that were the right solution.
Thanks in advance.