Module: Sequel::Plugins::AutoValidations::ClassMethods
- Defined in:
- lib/sequel/plugins/auto_validations.rb
Instance Attribute Summary collapse
-
#auto_validate_explicit_not_null_columns ⇒ Object
readonly
The columns with automatic not_null validations for columns present in the values.
-
#auto_validate_max_length_columns ⇒ Object
readonly
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 ⇒ Object
readonly
The columns with automatic not_null validations.
-
#auto_validate_unique_columns ⇒ Object
readonly
The columns or sets of columns with automatic unique validations.
Instance Method Summary collapse
-
#auto_validate_presence? ⇒ Boolean
Whether to use a presence validation for not null columns.
-
#auto_validate_types? ⇒ Boolean
Whether to automatically validate schema types for all columns.
-
#skip_auto_validations(type) ⇒ Object
Skip automatic validations for the given validation type (:not_null, :types, :unique).
Instance Attribute Details
#auto_validate_explicit_not_null_columns ⇒ Object (readonly)
The columns with automatic not_null validations for columns present in the values.
74 75 76 |
# File 'lib/sequel/plugins/auto_validations.rb', line 74 def auto_validate_explicit_not_null_columns @auto_validate_explicit_not_null_columns end |
#auto_validate_max_length_columns ⇒ Object (readonly)
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.
78 79 80 |
# File 'lib/sequel/plugins/auto_validations.rb', line 78 def auto_validate_max_length_columns @auto_validate_max_length_columns end |
#auto_validate_not_null_columns ⇒ Object (readonly)
The columns with automatic not_null validations
71 72 73 |
# File 'lib/sequel/plugins/auto_validations.rb', line 71 def auto_validate_not_null_columns @auto_validate_not_null_columns end |
#auto_validate_unique_columns ⇒ Object (readonly)
The columns or sets of columns with automatic unique validations
81 82 83 |
# File 'lib/sequel/plugins/auto_validations.rb', line 81 def auto_validate_unique_columns @auto_validate_unique_columns end |
Instance Method Details
#auto_validate_presence? ⇒ Boolean
Whether to use a presence validation for not null columns
87 88 89 |
# File 'lib/sequel/plugins/auto_validations.rb', line 87 def auto_validate_presence? @auto_validate_presence end |
#auto_validate_types? ⇒ Boolean
Whether to automatically validate schema types for all columns
92 93 94 |
# File 'lib/sequel/plugins/auto_validations.rb', line 92 def auto_validate_types? @auto_validate_types end |
#skip_auto_validations(type) ⇒ Object
Skip automatic validations for the given validation type (:not_null, :types, :unique). If :all is given as the type, skip all auto validations.
98 99 100 101 102 103 104 105 106 |
# File 'lib/sequel/plugins/auto_validations.rb', line 98 def skip_auto_validations(type) if type == :all [:not_null, :types, :unique, :max_length].each{|v| skip_auto_validations(v)} elsif type == :types @auto_validate_types = false else send("auto_validate_#{type}_columns").clear end end |