You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I didn't want to rush into forking and submitting a PR because frankly I don't have much experience digging into code and contributing to large projects... but I took a look at the code for the relevant plugins, and I suspect this might be accomplished with a change to line 184 of sequel/plugins/auto_validations.rb, from:
validates_schema_types(keys, opts[:schema_types]) if model.auto_validate_types?
to:
validates_schema_types(class.responds_to?(:serialization_map) ? keys - class.serialization_map.keys : keys, opts[:schema_types]) if model.auto_validate_types?
(I would write it differently, putting the key-building code on it's own line and saving the results to a local variable, but I figured the most conservative approach would be start with the minimal change and go from there.)
BTW - The only reason I got this far was because of how cleanly the code is written, so thanks!
The auto_validations plugin already uses the :from=>:values option to check the underlying values. If you want to use validates_schema_types with the serialization plugin, use the :from=>:values option just as the auto_validations plugin does, so it looks at the serialized value instead of the deserialized value.
Note that as mentioned in the contribution guidelines, GitHub Issues should only be used to report bugs in the library, not for feature requests like this. Please use IRC or the sequel-talk Google Group to request features or ask for help in the future.
I'm currently using the Serialization plugin to map an array in ruby to a text column as JSON.
I just tried out the
validates_schema_types
helper, and got an "is not a valid string" error on that column.Would be convenient if the
validates_schema_types
would check for the Serialization plugin and skip columns that have been configured with it.The text was updated successfully, but these errors were encountered: