Ash FrameworkAF
Ash Framework3y ago
4 replies
Blibs

Atom fields will save upcase atoms as downcase

I noticed that if I add an attribute like this:

    attribute :currency, :atom do
      allow_nil? false

      constraints one_of: [:USD, :BRL, ...]
    end


And then save a :USD or :BRL value to it, when I retrieve the record, the value will be retrieved in lower case (ex. :BRL will be returned as :brl).

Is this by design? In my case I want to store the currencies supported by the Money library, but they are all in upper case, meaning that when i get them back, they are considered invalid by the Money library.
Was this page helpful?