Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests fail/ Rails site fails #3

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

tests fail/ Rails site fails #3

bradleyd opened this issue Nov 10, 2009 · 1 comment

Comments

@bradleyd
Copy link

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
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant