binda
binda copied to clipboard
Radio button has 2 choices
Expected behavior
I'd expect a Radio button to have 1 choice.
Actual behavior
Radio button has 2 choices.
How to reproduce the issue
The current issue happens on a repeater. Haven't tried on components.
- Create a structure with a repeater field with nothing in it.
- Create some components from that structure and add few repeater instances.
- Go back to the structure and create a new radio field inside the repeater
- Save and refresh
- Modify the radio field choices updating the temporary choice with a different name (say final choice with value
final) - Now open Rails console and select one component and get the choices related to the radio of the first repeater.
Binda::Radio.where( field_setting_id: "your-radio-field-setting-id", fieldable_id: Binda::Repeater.where( field_setting_id: "your-repeater-field-setting-id", fieldable_id: Binda::Component.where(structure_id: "your-structure-id").first ) ).first.choices.map(&:value) # => ["final", "final"]
If then I assign a choice manually the same query returns just one value.
System configuration
Binda version: 0.1.9
Rails version: 5.1.4
Apparently it's possible to assign multiple choices (as many as you wnat) via Rails Console. This shouldn't be possible...