Sometimes we need to memoize/cache expensive operations. A typical case is to avoid multiple database calls. A common Ruby technique is to use the lazy evaluation operator ||= def customer @customer ||= Customer.find(@customer_id) end If @cu...
Markdown supported · ⌘↵ to post
No responses yet.