# Cache-money and background tasks

**URL:** <https://www.ruby-forum.com/t/cache-money-and-background-tasks/169982>\
**Category:** Rails\
**Created:** [June 10, 2009, 10:31pm UTC](https://www.ruby-forum.com/t/cache-money-and-background-tasks/169982 "2009-06-10T22:31:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e19adc/32.png) [@davis](https://www.ruby-forum.com/u/davis)\
**Post date:** [June 10, 2009, 10:31pm UTC](https://www.ruby-forum.com/t/cache-money-and-background-tasks/169982/1 "2009-06-10T22:31:01Z")

</div>

I have been attempting to use cache-money on a new project and ran  
into a major problem. Normally it seems to be working as advertised  
but completely falls over when attempting to register a background  
task with BJ. Here is the error:

NoMethodError (You have a nil object when you didn’t expect it!  
The error occurred while evaluating nil.repository):  
( **DELEGATION** ):2:in ` __send__' ( __DELEGATION__ ):2:in`repository’  
/Library/Ruby/Gems/1.8/gems/nkallen-cache-money-0.2.5/lib/  
cache\_money.rb:50:in `transaction' bj (1.0.1) lib/bj/table.rb:240:in`get’  
bj (1.0.1) lib/bj/table.rb:236:in `[]' bj (1.0.1) lib/bj/runner.rb:61:in`tickle’  
bj (1.0.1) lib/bj/api.rb:66:in `submit’

I have seen other posts that suggest using  
‘transaction\_without\_cache\_transaction’ or attempting to only enable  
cache-money for certain models (instead of everything by default) but  
neither provided an adequate solution to the problem.

It seems like this could be solved by either not including cache-money  
into each model, or being able to pass the correct information (or  
redefine it) for processes outside the normal rails app.

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![davis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e19adc/32.png) [@davis](https://www.ruby-forum.com/u/davis)\
**Post date:** [June 11, 2009, 12:30am UTC](https://www.ruby-forum.com/t/cache-money-and-background-tasks/169982/2 "2009-06-11T00:30:04Z")

</div>

Check out one of the cache money forks on GitHub. I believe one of  
them has fixed this problem.
