Hi, class User < ActiveRecord::Base def self.get_cache(id) Rails.cache.fetch("users/#{id}") { find(id) } end end Accesing a cached model object immediately after caching works as expected: User.get_cache(1).cache_key # => OK But once I try to do the same from another action it''s not possible anymore. I get an error message "stack level too deep". User.get_cache(1).cache)key # => SystemStackError (stack level too deep): /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/attribute_methods.rb:64:in `generated_methods?'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/attribute_methods.rb:237:in `method_missing'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/attribute_methods.rb:245:in `method_missing'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/base.rb:2167:in `cache_key'' /app/controllers/users_controller.rb:5:in `index'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/ action_controller/base.rb:1162:in `send'' What am I doing or thinking wrong? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
take a look at: http://www.ruby-forum.com/topic/157364 you enable class caching changing "config.cache_classes" to true in your config/development.rb file. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It''s look like a bug to reload environment each time after code edit.. Any other ideas? Thanks for the response. On Jul 24, 4:06 pm, PP Junty <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> take a look at:http://www.ruby-forum.com/topic/157364 > > you enable class caching changing "config.cache_classes" > to true in your config/development.rb file. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Any update on this caching bug? It''s driving me crazy. Please, post a solution if you''ve figured this out, or know of a resource that will help me understand it better. Thanks. (from http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/c74a74df959c56ee) These seem to be related: http://dev.rubyonrails.org/ticket/10896 http://dev.rubyonrails.org/ticket/10722 http://railscasts.com/episodes/115 http://zilkey.com/2008/7/5/rails-cache-memcached-development-mode-and... But I still haven''t seen a definitive solution. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---