Methods
Public Instance
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_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 156 def auto_validate_presence? 157 @auto_validate_presence 158 end
Whether to automatically validate schema types for all columns
# File lib/sequel/plugins/auto_validations.rb 161 def auto_validate_types? 162 @auto_validate_types 163 end
Freeze auto_validation settings when freezing model class.
# File lib/sequel/plugins/auto_validations.rb 166 def freeze 167 @auto_validate_no_null_byte_columns.freeze 168 @auto_validate_not_null_columns.freeze 169 @auto_validate_explicit_not_null_columns.freeze 170 @auto_validate_max_length_columns.freeze 171 @auto_validate_unique_columns.freeze 172 173 super 174 end
Skip automatic validations for the given validation type (:not_null, :types, :unique, :max_length, :no_null_byte). If :all is given as the type, skip all auto validations.
# File lib/sequel/plugins/auto_validations.rb 179 def skip_auto_validations(type) 180 case type 181 when :all 182 [:not_null, :no_null_byte, :types, :unique, :max_length].each{|v| skip_auto_validations(v)} 183 when :not_null 184 auto_validate_not_null_columns.clear 185 auto_validate_explicit_not_null_columns.clear 186 when :types 187 @auto_validate_types = false 188 else 189 public_send("auto_validate_#{type}_columns").clear 190 end 191 end