Friday, February 11, 2011

cache_money for Rails 3

I've used various forks (mostly the ngmoco fork) of Nick Kallen's excellent cache_money for several Rails 2.3 based project, but we're now making the leap to Rails 3 which, thanks to the introduction of ActiveRelation, does not work with the popular forks of cache_money.

Is there a fork of cache_money, or an equivalent write-through cache, that is compatible with Rails 3 ?

  • There are a branch rails 3 in ngmoco fork to use you :

    http://github.com/ngmoco/cache-money/tree/rails3

    You can try it I don't know if it's really works.

    You can add this in your Gemfile by

    gem 'cache_money', :git => 'git://github.com/ngmoco/cache-money.git', :branch => 'rails3'
    
    Marc Roberts : I hadn't seen the rails3 branch from ngmoco, which is surprising and embarrassing as thats the fork I use generally. I'm trying this out now
    shingara : it's happen sometimes. No problem. If it's works, it's really great for you. We can hope it's works
    Marc Roberts : Doesn't look like this is complete yet, it's not recognised as a valid gem source. "Could not find gem 'cache-money (>= 0, runtime)' in git://github.com/ngmoco/cache-money.git (at rails3). Source does not contain any versions of 'cache-money (>= 0, runtime)'" Maybe this is still a work in progress, I'll get in contact with the authors
    shingara : you just need generate the gemspec in this repository. Fork the project, launch rake gemspec, commit the gemspec and use your fork in your Gemfile
    Marc Roberts : I have managed to get it to run without errors as a plugin, and also as a gem with the missing gemspec in place. It doesn't appear to actually do any caching though, in fact it appears to do nothing whatsoever. I've configured it correctly, initialised it as it should be, added explicit indices. It loads and creates its objects and extends ActiveRecord as expected, but then does nothing. I'll keep digging
    Marc Roberts : I've heard back from the guy working on the rails3 branch and he has confirmed that it is very much incomplete and he's gone back to the drawing board because of the ActiveRelation changes.
    From shingara

0 comments:

Post a Comment