cache_fu
cache_fu copied to clipboard
tests fail/ Rails site fails
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:
- 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:in
first' ./lib/acts_as_cached/cache_methods.rb:184:incache_key' ./lib/acts_as_cached/local_cache.rb:7:in
fetch_cache' ./lib/acts_as_cached/cache_methods.rb:31:inget_cache' ./lib/acts_as_cached/cache_methods.rb:230:in
get_cache' test/local_cache_test.rb:13:intest_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: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' /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:in `run'
I am using:
- memcache-client (1.7.5)
- rails (2.0.2)
- cache_fu verison??
Any help would be greatly appreciated.
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.