tests fail/ Rails site fails #3

Open
bradleyd opened this Issue Nov 10, 2009 · 1 comment

Comments

Projects
None yet
1 participant

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment