Skip to content

Conversation

@aronbeal
Copy link
Contributor

We looked over this for awhile before we decided it was a bug. In the case of allowed values in field info, the function had inverted the key/value pairings, and set the key as the return value, but in the case of callback functions, it sets the value of allowed_values as the return value. This is despite the fact that the callback function is supposed to return a mapping of raw=>display values, which would mean that the display value was what was stored in the db (which was what was happening for us during api calls).

This corrects the handling so that, in each case, the options array is generated from a flip of the allowed values, and then handling of that options array is identical from that point forward.

We looked over this for awhile before we decided it was a bug.  In the case of allowed values in field info, the function had inverted the key/value pairings, and set the *key* as the return value, but in the case of callback functions, it sets the *value* of allowed_values as the return value.  This is despite the fact that the callback function is supposed to return a mapping of raw=>display values, which would mean that the display value was what was stored in the db (which was what was happening for us during api calls).

This corrects the handling so that, in each case, the options array is generated from a flip of the allowed values, and then handling of that options array is identical from that point forward.
@aronbeal
Copy link
Contributor Author

Related issue: #55

@jhedstrom jhedstrom merged commit b059284 into jhedstrom:master Sep 24, 2016
@jhedstrom
Copy link
Owner

Thanks!

jhedstrom added a commit that referenced this pull request Sep 24, 2016
Corrects handling of callback-based lists.

Signed-off-by: Jonathan Hedstrom <jhedstrom@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants