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

Setting cache_options expiration without prefix causes prefix to default to nil instead of "geocoder:" #1585

Open
corwinstephen opened this issue Jun 21, 2022 · 3 comments
Labels

Comments

@corwinstephen
Copy link

corwinstephen commented Jun 21, 2022

Expected behavior

With:

Geocoder.configure(
  cache_options: {
    expiration: 1.days },
)
Geocoder.config[:cache_options][:prefix]

should be geocoder:

Actual behavior

Geocoder.config[:cache_options][:prefix]

is nil

Steps to reproduce

Use

Geocoder.configure(
  cache_options: {
    expiration: 1.days },
)

as your config. Then call Geocoder.config[:cache_options][:prefix]

Environment info

  • Geocoder version: 1.8.0
  • Rails version: 6.1.3.2
  • Database (if applicable):
  • Lookup (if applicable):
@alexreisner
Copy link
Owner

Thanks for this, and sorry for the delay. I agree that this behavior is unexpected. The hash should probably be merged into cache_options, instead of replacing it. I'm open to a PR for this.

@alexreisner
Copy link
Owner

Hmm, I just realized there's a conflict here. Currently, when passing a hash to Geocoder.configure to set options for a particular service (eg: Geocoder.configure(esri: {token: '...', for_storage: true})), the behavior is to overwrite, not merge. So changing to merge could break apps and therefore requires a minor version release.

@corwinstephen
Copy link
Author

Sounds good to me--thanks for taking a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants