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.
If I configure an item like this
Configurable.geoip_whitelist_countriesConfigurable.find_or_create_by(name: 'geoip_whitelist_countries').update_attribute(:value, "AF")Configurable.find_or_create_by(name: 'geoip_whitelist_countries').update_attribute(:value, ["AF", "CH"])[["[\"AF\"", " \"CH\"]"]]where I expect a ["AF", "CH"]Configurable.find_or_create_by(name: 'geoip_whitelist_countries').update_attribute(:value, "AF,CH")[["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.