G5 / storext

Add type-casting and other features on top of ActiveRecord::Store.store_accessor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Booleans from Forms stored as "1" or "0"

mscoutermarsh opened this issue · comments

Noticing that Boolean values when updated from a Rails form are being stored as "1" or "0" instead of true/false.

More Info:

example_setting Boolean, default: true

If I set example_setting from a console. object.example_setting = true. It is stored correctly.

{ "example_setting": true }

But if I submit it from a Rails form (which uses 1 or 0 for true/false).

{ "example_setting": "1" }

This still works as expected & doesn't cause any problems. But I think it would be best if 1's and 0's are translated to true/false for consistency.

Note: I'm using JSONB for my storeaccessor.

Btw: Of course, I'm happy to do a PR to help out with this. 😄

Yeah sure why not?