Module: Sequel::Plugins::ValidationHelpersGenericTypeMessages
- Defined in:
- lib/sequel/plugins/validation_helpers_generic_type_messages.rb
Overview
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
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
Class Method Details
.apply(mod) ⇒ Object
54 55 56 |
# File 'lib/sequel/plugins/validation_helpers_generic_type_messages.rb', line 54 def self.apply(mod) mod.plugin :validation_helpers end |