Hi all, I was starting to implement caching with memcached in one of our projects that still uses Rails 2.3 (yes, still). As Rails only caches Active Record objects for one request, I thought of caching them on memcached. For that, I''ve defined a method that intercepts the find method of Active Record and checks if the object is in the cache before hitting the actual find of Active Record. Although, I''m getting an error of "Can''t modify a frozen hash" after retrieving an object from the cache and trying to update it. I''ve done some research and found that objects are frozen by AR before they get saved. I found the following hack on google that solves the problem: if Rails.version <= "2.3.8" module ActiveRecord class Base def dup obj = super obj.instance_variable_set(''@attributes'', instance_variable_get(''@attributes'').dup) obj end end end end I have two questions about it: - Is it a good solution to use dup like that? - Is it a bad/good practice to cache Active Record objects? Thanks in advance, Tales Marchesan Chaves Software Designer @Hewlett-Packard Brazil -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.