4 ms·
Which then, if I'm not mistaken, boils down to: Post.all.group_by {|post| post.name[0] }
by Andys 15y ago
Which then, if I'm not mistaken, boils down to:
Post.all.group_by {|post| post.name[0] }
- tptacek 15y agoHe wants to enumerate over the empty lists for first letters not used by posts too, apparently.
- dennyabraham 15y agowhat i found odd about the original, that's clarified here, is that it's not really separating a concern. when, for moderate amounts of data, for nontrivially complex applications, you want to improve the performance of a call like this, you'll be digging into arel and lazy enumeration, both of which depend on how you access the datastore via activerecord.