Open constantm opened 11 years ago
open rails the console and run: Cashier.adapter
. What does it say?
Loading development environment (Rails 3.2.6)
irb(main):001:0> Cashier.adapter
NameError: uninitialized class variable @@adapter in Cashier
from /usr/local/opt/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/cashier-0.4.0/lib/cashier.rb:7:in `adapter'
from (irb):1
from /usr/local/opt/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
from /usr/local/opt/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
from /usr/local/opt/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
irb(main):002:0>
Any feedback?
This baffled me for a long time, but I've got it to work now. Instead of following the documentation in this Github repo, create a new initializer and add
Cashier.adapter = :redis_store
Cashier.adapter.redis = Redis.new(:host => '127.0.0.1', :port => '3697') # or, actually Resque.redis in our case
That's for Redis, you can set Cashier.adapter
to whatever store you were wanting to use.
Thanks @lukes - I ended up not using Cashier, but will try it again in the future.
I'm trying to use this Gem with no luck - I can't figure out from the documentation if I'm using it correctly.
I have an products index, with various combinations of query strings. I would like to cache these all under a tag, and then clear all cached items in a tag when a product is changed, removed or added.
In my Products controller I have:
When trying to use Cashier as above, I get the following:
What am I doing wrong? Any help would be greatly appreciated.