DEV Community

Discussion on: Ruby/Rails : Memoization with dynamically defined methods

Collapse
 
ritikesh profile image
Ritikesh

You are right, ActiveRecord does cache results, but not always. Like when you use scopes or self methods or finder methods etc. In most real-world use cases, you wouldn't do a User.all anyway. I'll try to update to a better example sometime later, but the gist was to suggest how to memoize dynamic methods. :)