Methods
Public Instance
- auto_validate_explicit_not_null_columns
- auto_validate_max_length_columns
- auto_validate_max_value_columns
- auto_validate_min_value_columns
- auto_validate_no_null_byte_columns
- auto_validate_not_null_columns
- auto_validate_options
- auto_validate_presence?
- auto_validate_types?
- auto_validate_unique_columns
- freeze
- skip_auto_validations
Attributes
| 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_max_value_columns | [R] |
The columns with automatch max value validations, as an array of pairs, with the first entry being the column name and second entry being the maximum value. |
| auto_validate_min_value_columns | [R] |
The columns with automatch min value validations, as an array of pairs, with the first entry being the column name and second entry being the minimum value. |
| auto_validate_no_null_byte_columns | [R] |
The columns with automatic no_null_byte validations |
| 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 |
Public Instance methods
Whether to use a presence validation for not null columns
# File lib/sequel/plugins/auto_validations.rb 177 def auto_validate_presence? 178 @auto_validate_presence 179 end
Whether to automatically validate schema types for all columns
# File lib/sequel/plugins/auto_validations.rb 182 def auto_validate_types? 183 @auto_validate_types 184 end
Freeze auto_validation settings when freezing model class.
# File lib/sequel/plugins/auto_validations.rb 187 def freeze 188 @auto_validate_no_null_byte_columns.freeze 189 @auto_validate_not_null_columns.freeze 190 @auto_validate_explicit_not_null_columns.freeze 191 @auto_validate_max_length_columns.freeze 192 @auto_validate_max_value_columns.freeze 193 @auto_validate_min_value_columns.freeze 194 @auto_validate_unique_columns.freeze 195 196 super 197 end
Skip automatic validations for the given validation type (:not_null, :no_null_byte, :types, :unique, :max_length, :max_value, :min_value). If :all is given as the type, skip all auto validations.
Skipping types validation automatically skips max_value and min_value validations, since those validations require valid types.
# File lib/sequel/plugins/auto_validations.rb 205 def skip_auto_validations(type) 206 case type 207 when :all 208 [:not_null, :no_null_byte, :types, :unique, :max_length, :max_value, :min_value].each{|v| skip_auto_validations(v)} 209 when :not_null 210 auto_validate_not_null_columns.clear 211 auto_validate_explicit_not_null_columns.clear 212 when :types 213 @auto_validate_types = false 214 else 215 public_send("auto_validate_#{type}_columns").clear 216 end 217 end