| Module | Sequel::Plugins::AutoValidations::ClassMethods |
| In: |
lib/sequel/plugins/auto_validations.rb
|
| auto_validate_explicit_not_null_columns | [R] | The columns with automatic not_null validations for columns present in the values. |
| auto_validate_max_length_columns | [R] | The columns or sets of columns with automatic max_length validations, as an array of pairs, with the first entry being the column name and second entry being the maximum length. |
| auto_validate_not_null_columns | [R] | The columns with automatic not_null validations |
| auto_validate_options | [R] | Inherited options |
| auto_validate_unique_columns | [R] | The columns or sets of columns with automatic unique validations |
Whether to use a presence validation for not null columns
# File lib/sequel/plugins/auto_validations.rb, line 121
121: def auto_validate_presence?
122: @auto_validate_presence
123: end
Whether to automatically validate schema types for all columns
# File lib/sequel/plugins/auto_validations.rb, line 126
126: def auto_validate_types?
127: @auto_validate_types
128: end
Freeze auto_validation settings when freezing model class.
# File lib/sequel/plugins/auto_validations.rb, line 131
131: def freeze
132: @auto_validate_not_null_columns.freeze
133: @auto_validate_explicit_not_null_columns.freeze
134: @auto_validate_max_length_columns.freeze
135: @auto_validate_unique_columns.freeze
136:
137: super
138: end
Skip automatic validations for the given validation type (:not_null, :types, :unique). If :all is given as the type, skip all auto validations.
# File lib/sequel/plugins/auto_validations.rb, line 142
142: def skip_auto_validations(type)
143: case type
144: when :all
145: [:not_null, :types, :unique, :max_length].each{|v| skip_auto_validations(v)}
146: when :not_null
147: auto_validate_not_null_columns.clear
148: auto_validate_explicit_not_null_columns.clear
149: when :types
150: @auto_validate_types = false
151: else
152: public_send("auto_validate_#{type}_columns").clear
153: end
154: end