The validation_helpers_generic_type_messages plugin overrides the default type validation failure messages in the validation_helpers plugin to be more generic and understandable by the average user, instead of always be based on the names of the allowed classes for the type. For example:
# :blob type # validation_helpers default: "value is not a valid sequel::sql::blob" # with this plugin: "value is not a blob" # :boolean type # validation_helpers default: "value is not a valid trueclass or falseclass" # with this plugin: "value is not true or false" # :datetime type # validation_helpers default: "value is not a valid time or datetime" # with this plugin: "value is not a valid timestamp" # custom/database-specific types # validation_helpers default: "value is not a valid sequel::class_name" # with this plugin: "value is not the expected type"
It is expected that this plugin will become the default behavior of validation_helpers in Sequel
6.
To enable this the use of generic type messages for all models, load this plugin into Sequel::Model
.
Sequel::Model.plugin :validation_helpers_generic_type_messages
Classes and Modules
Public Class methods
apply(mod)
[show source]
# File lib/sequel/plugins/validation_helpers_generic_type_messages.rb 54 def self.apply(mod) 55 mod.plugin :validation_helpers 56 end