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

Support Rails-compatible cache initialization #39

Closed
alaz opened this issue Sep 6, 2018 · 3 comments
Closed

Support Rails-compatible cache initialization #39

alaz opened this issue Sep 6, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@alaz
Copy link

alaz commented Sep 6, 2018

Tell us about your environment

Ruby Version: 2.5

Framework Version (Rails, whatever): Rails 5.2.1

Action Policy Version: 0.2.3

What did you do?

I have initialized Action Policy's cache in exactly the same way as Rails documentation recommends:

config.action_policy.cache_store = :mem_cache_store, ENV['MEMCACHE_SERVERS'], {namespace: "r2", compress: true, pool: 32}

What actually happened?

Exception:

vendor/bundle/jruby/2.5.0/gems/action_policy-0.2.3/lib/action_policy/policy/cache.rb:45:in `block in apply_with_cache': undefined method `read' for #<Array:0xd0fabc8> (NoMethodError)
    from org/jruby/RubyKernel.java:1301:in `yield_self'
    from vendor/bundle/jruby/2.5.0/gems/action_policy-0.2.3/lib/action_policy/policy/cache.rb:44:in `apply_with_cache'
    from vendor/bundle/jruby/2.5.0/gems/action_policy-0.2.3/lib/action_policy/policy/cache.rb:58:in `apply'
    from vendor/bundle/jruby/2.5.0/gems/action_policy-0.2.3/lib/action_policy/policy/cached_apply.rb:18:in `apply'
    from vendor/bundle/jruby/2.5.0/gems/action_policy-0.2.3/lib/action_policy/policy/reasons.rb:98:in `allowed_to?'
    from app/policies/topic_policy.rb:7:in `show?'

@palkan palkan added investigate Something is probably wrong bug Something isn't working and removed investigate Something is probably wrong labels Sep 6, 2018
@palkan palkan closed this as completed in f80ca30 Sep 6, 2018
@palkan
Copy link
Owner

palkan commented Sep 6, 2018

Thanks for the report!

Just pushed a fix to master, check, please.

@alaz
Copy link
Author

alaz commented Sep 6, 2018

Fixed. Thank you!

@palkan
Copy link
Owner

palkan commented Sep 6, 2018

Released as 0.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants