NOTE: this package is not compatible with Elm 0.19.1
Function for creating a Decoder that decodes errors formatted by rails. It is expecting JSON formatted as:
{ errors: {errorName: ["Error String"] } }.
{ errors: {errorName: ["Error String"] } }
To create the decoder, pass a dict mapping your Strings to Fields that mimic the expected nesting, eg.
mappings = Dict.fromList [ ( "school", School ) , ( "school.name", SchoolName ) , ( "school.address", SchoolAddress ) , ( "school.city", City ) , ( "school.state", State ) , ( "school.zip", Zip ) , ( "school.country", Country ) ] railsErrorsDecoder = Rails.Decode.errors mappings
Function for creating a Decoder that decodes errors formatted by rails. It is expecting JSON formatted as:
{ errors: {errorName: ["Error String"] } }.To create the decoder, pass a dict mapping your Strings to Fields that mimic the expected nesting, eg.