Fix error on column names with underscores.#158
Fix error on column names with underscores.#158yawboakye wants to merge 1 commit intoJSONAPI-Resources:masterfrom yawboakye:fix-param-not-allowed-error-on-column-names-with-underscores
Conversation
The allowed fields are formatted and collected in `formatted_allowed_fields` array, which is used during the comparison. During comparison though, keys from the `params[:data]` hash are not formatted before verifying whether they are allowed. Thus keys with underscores will always fail. This fix makes sure the comparison is done using the formatted version of the keys.
|
I think I should clean up the logic in I'm going to close this PR. If it's still an issue please open a new issue and we can discuss the details. |
|
@lgebhardt Is the keys in the request payload expected to be dasherized? Then that's fine. Otherwise, even though the elements of |
|
@yawboakye The I've added #168 to test this. |
|
@lgebhardt I made the wrong assumptions about the default |
|
@yawboakye No problem. This made me see I was missing some tests for the formatted keys, so that helps. |
The allowed fields are formatted and collected in
formatted_allowed_fieldsarray, which is used during the comparison.During comparison though, keys from the
params[:data]hash are notformatted before verifying whether they are allowed. Thus keys with
underscores will always fail. This fix makes sure the comparison is done
using the formatted version of the keys.