Skip to content

List type store/read with Rails 4 #34

@dup2

Description

@dup2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions