cache_fu icon indicating copy to clipboard operation
cache_fu copied to clipboard

tests fail/ Rails site fails

Open bradleyd opened this issue 15 years ago • 1 comments

I cant seem to get cache_fu going. I inherited a site that had to be moved over locally and it keeps failing with this error:

  1. Error: test_spec {When local_cache_for_request is called} 001 [get_cache should pull from the local cache on a second hit](When local_cache_for_request is called): NoMethodError: undefined method []' for #<Enumerable::Enumerator:0x7f3aa057cbf0> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/string/access.rb:43:infirst' ./lib/acts_as_cached/cache_methods.rb:184:in cache_key' ./lib/acts_as_cached/local_cache.rb:7:infetch_cache' ./lib/acts_as_cached/cache_methods.rb:31:in get_cache' ./lib/acts_as_cached/cache_methods.rb:230:inget_cache' test/local_cache_test.rb:13:in test_spec {When local_cache_for_request is called} 001 [get_cache should pull from the local cache on a second hit]' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:442:inrun' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:441:in each' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:441:inrun' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:442:in run' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:441:ineach' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:441:in `run'

I am using:

  • memcache-client (1.7.5)
  • rails (2.0.2)
  • cache_fu verison??

Any help would be greatly appreciated.

bradleyd avatar Nov 10 '09 14:11 bradleyd

i solved the issue. I will put this up for anyone who needs it. Turned out that the site was written in a previous version of ruby. There is a string char method issue with rails < 2.2. So the easy fix was Copy this code to the environment.rb.

unless '1.9'.respond_to?(:force_encoding) String.class_eval do begin remove_method :chars rescue NameError # OK end end end

hope that helps.

bradleyd avatar Nov 11 '09 21:11 bradleyd