DmitryTsepelev / store_model

Work with JSON-backed attributes as ActiveRecord-ish models
MIT License
1.09k stars 89 forks source link

Enums are incorrectly serialized using as_json #151

Closed wooly closed 1 year ago

wooly commented 1 year ago

It appears that enum attributes aren't properly being serialized using as_json.

I've attached a failing test case for it - I'd expect the configuration as json to convert back from integer to stringified-symbol of the enum key.

DmitryTsepelev commented 1 year ago

Hey! I build a quick prototype, will try to complete this week

wooly commented 1 year ago

@DmitryTsepelev youโ€™re a legend, let me know if I can help ๐Ÿ‘

DmitryTsepelev commented 1 year ago

@wooly here it is https://github.com/DmitryTsepelev/store_model/pull/153 โ€” could you please try it before I merge it in? Please note that you will need to explicitly turn it on, cause I won't make a 3.0.0 after 2.0.1 ๐Ÿ™‚

wooly commented 1 year ago

@DmitryTsepelev thanks heaps, this is working well! Noted RE explicitly turning it on, that's fine.