Closed ericdfields closed 7 years ago
This is totally a bug!
- const propsWithDefault = { defaultValue: 0, ...props }
+ const propsWithDefault = { defaultValue: 1, ...props }
Now I'm wondering if we should even use defaultValue
, or should we rather use a specifically named prop of checkedValue
to complement uncheckedValue
🤔
Something like that sounds right. And the name needs to get passed into the HiddenFieldTag.
On Jan 25, 2017, at 13:20, Dan Ott notifications@github.com wrote:
This is totally a bug!
- const propsWithDefault = { defaultValue: 0, ...props }
- const propsWithDefault = { defaultValue: 1, ...props } Now I'm wondering if we should even use defaultValue, or should we rather use a specifically named prop of checkedValue to complement uncheckedValue 🤔
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
This has been fixed in https://github.com/danott/react-rails-form-helpers/commit/4e409cc85470f28af2d731d7d63c24feae1de047, and released as beta.12.
I'm sending down data from a rails backend using active model serializers to form the json. Booleans come down as simply true or false, but checkboxes in rails want to work with 1/0. I'm not sure whether your lib is the problem, or if it's me.
If i use CheckBox like so:
It produces:
What rails wants is:
I've pulled this off rather inelegantly for now, complete with react yelling at my in dev mode by creating my own Checkbox component, like so:
This works for me for now. Is there a bug in the lib, or am I just handling my booleans wrong?