Chris, I switched to cache_fu and still had the same problem.
I'm using Rails 1.2.1, Ruby 1.8.4, memcache-client 1.2.1, and I
checked out cache_fu today.
The general controller isn't doing anything funky:
++++++++++++++++++++++++++++++
class GeneralController < ApplicationController
before_filter :login_required
def index
@user = current_user
end
end
++++++++++++++++++++++++++++++
current_user comes from authentication_system. The following is the
main line where current_user is being found:
++++++++++++++++++++++++++++++
def logged_in?
(@current_user ||= session[:user] ?
User.get_cache(session[:user]) : :false).is_a?(User)
end
++++++++++++++++++++++++++++++
I was able to get the autoloading working when I did the following to
line 56 of /lib/acts_as_cached/cache_methods.rb:
++++++++++++++++++++++++++++++
rescue ArgumentError, MemCache::MemCacheError => error
++++++++++++++++++++++++++++++
If you're curious, here is the backtrace where things start to go
wrong:
++++++++++++++++++++++++++++++
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:904:in
`load'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:904:in
`restore'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:805:in
`fetch'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:1035:in
`send'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:1017:in
`send'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:795:in
`fetch'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:926:in
`add_stat'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:783:in
`fetch'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:345:in
`get'
lib/ruby/1.8/sync.rb:229:in `synchronize'
lib/ruby/gems/1.8/gems/Ruby-MemCache-0.0.1/lib/memcache.rb:344:in
`get'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
cache_methods.rb:50:in `fetch_cache_without_benchmarking'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
cache_methods.rb:55:in `autoload_missing_constants'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
cache_methods.rb:49:in `fetch_cache_without_benchmarking'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
benchmarking.rb:30:in `fetch_cache'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
benchmarking.rb:18:in `cache_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/
benchmarking.rb:37:in `silence'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
benchmarking.rb:18:in `cache_benchmark'
/lib/ruby/1.8/benchmark.rb:293:in `measure'
/lib/ruby/1.8/benchmark.rb:307:in `realtime'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
benchmarking.rb:17:in `cache_benchmark'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
benchmarking.rb:29:in `fetch_cache'
#{RAILS_ROOT}/vendor/plugins/cache_fu/lib/acts_as_cached/
cache_methods.rb:18:in `get_cache'
#{RAILS_ROOT}/lib/authenticated_system.rb:6:in `logged_in?'
#{RAILS_ROOT}/lib/authenticated_system.rb:83:in `login_required'
On Feb 6, 4:54 pm, "Chris Wanstrath" <c...@ozmm.org> wrote:
> On 2/5/07, fightinjoe <fightin
...@gmail.com> wrote:
> > When I do this, I get the following error:
> > ArgumentError in GeneralController#index: undefined class/module Group
> > Before I start trying to figure out Rails's auto-include hooks, does
> > anyone have any insight as to a better way to deal with this issue?
> This is interesting because acts_as_cached has code to trigger Rails'
> autoloading in the situation you describe. Specifically:
> http://require.errtheblog.com/plugins/browser/cache_fu/lib/acts_as_ca...
> The "autoload_missing_constants" method (yes I know this is cache_fu
> but the principle is the same, just cleaner in this version) should
> load Group if it doesn't exist.
> However, the error generated when Group is not found usually comes
> from Memcache.
> Can you send more information on your environment? Version of Rails,
> version of Ruby, version of memcache-client, revision of
> acts_as_cached (if you know), and, finally, perhaps the
> GeneralController#index code?
> Thanks.
> --
> Chris Wanstrathhttp://errtheblog.com