Open peck opened 10 years ago
This seems useful. Can you create a PR with some tests?
Will do, have to work through some things downstream in the process for updating attributes and making sure all is good there, but yes, Ill put it on my to-do list and see what I can come up with.
Shouldn't use OpenStruct here, just create a regular Struct somewhere to avoid method cache busting every time an hstore class is used in a form build.
+1 for no OpenStruct. In fact, it should respect the original return type of column_for_attribute as closely as possible. While Struct/OpenStruct might meet the needs of simple_form, it could be surprising to someone expecting a different object.
@peck, are you still hacking on this?
This c1c16fb7713464ccce79818cd7d0d6a856fae26b is a start on this.
Any interest in adding this to the gem itself? I find myself using using the following function in my models that I pass into simple_form builders to have the fields show up as the correct type, and not just default to text after receiving nil.