sorentwo / readthis

:newspaper: Pooled active support compliant caching with redis
MIT License
504 stars 40 forks source link

undefined method `[]' for nil:NilClass Error when cache method is called #1

Closed salimhb closed 9 years ago

salimhb commented 9 years ago

I'm trying to use this gem and get this error when cache is called in a haml template. While debugging it, I found that Readthis::Cache.read is called with nil as the second parameter for options.

code in haml:

- cache 'footer_links' do
  %h4
    ...

Stack trace: https://gist.github.com/salimhb/8f1b1c5a2e7c35f09dc2 My current bundle: https://gist.github.com/salimhb/f83f3ddb8b27226a626c

Am I doing anything wrong or is this a bug?

sorentwo commented 9 years ago

@salimhb Thanks for reporting the issue! I just pushed a patch for this issue, it was definitely a bug (at least in the way cache is being called). Can you try against master and let me know how it goes?

salimhb commented 9 years ago

awesome, it works :+1: By "the way cache is being called", you mean there was another way I could call it where this error wouldn't have occurred?

sorentwo commented 9 years ago

I don't think it is anything that you are doing, just the way cache behaves in a view without any arguments. Thanks for the report! This will be in the 0.4.0 release later today.

sorentwo commented 9 years ago

Released! You can reference 0.4.0 in your Gemfile now.