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

List type store/read with Rails 4 #34

Open
dup2 opened this issue Oct 19, 2016 · 0 comments
Open

List type store/read with Rails 4 #34

dup2 opened this issue Oct 19, 2016 · 0 comments

Comments

@dup2
Copy link

dup2 commented Oct 19, 2016

If I configure an item like this

geoip_whitelist_countries:
  default: []
  type: list
  • it returns a correct [] as the default using Configurable.geoip_whitelist_countries
  • It allows for updating with Configurable.find_or_create_by(name: 'geoip_whitelist_countries').update_attribute(:value, "AF")
    • and returns a correct ["AF"]
  • it allows for updating with Configurable.find_or_create_by(name: 'geoip_whitelist_countries').update_attribute(:value, ["AF", "CH"])
    • and returns a wrong value of [["[\"AF\"", " \"CH\"]"]] where I expect a ["AF", "CH"]
  • it allows for updating with Configurable.find_or_create_by(name: 'geoip_whitelist_countries').update_attribute(:value, "AF,CH")
    • and returns a wrong value of [["AF", "CH"]] (double array wrapping)

It seems the serialisation of the array does not work, a single value is stored a single string, an array is stored as escaped string and the return value is always wrapped in an array.

I'd expect the code to store and load arrays of values the way rails does this.

Is there something I missed from the documentation about the list type?

Thanks.

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

No branches or pull requests

1 participant