|
1 | | -module Flex |
| 1 | +module Strata |
2 | 2 | # Validations is a module that provides nested validation support for value objects. |
3 | 3 | # It extends ActiveModel::Validations to handle validation of nested attributes in a |
4 | 4 | # consistent way, propagating errors from nested objects to the parent model with |
5 | 5 | # appropriate attribute name prefixing. |
6 | 6 | # |
7 | 7 | # This module should be included in models that need to validate nested value objects. |
8 | | - # It provides the flex_validates_nested class method for defining these validations. |
| 8 | + # It provides the strata_validates_nested class method for defining these validations. |
9 | 9 | # It is automatically included in the Strata::Attributes module. |
10 | 10 | # |
11 | 11 | # @example Including Validations in a model and validating a nested date range |
12 | 12 | # class MyModel < ApplicationRecord |
13 | | - # include Flex::Validations |
| 13 | + # include Strata::Validations |
14 | 14 | # |
15 | | - # flex_validates_nested :period |
| 15 | + # strata_validates_nested :period |
16 | 16 | # end |
17 | 17 | # |
18 | 18 | module Validations |
19 | 19 | extend ActiveSupport::Concern |
20 | 20 | include ActiveModel::Validations |
21 | 21 |
|
22 | 22 | class_methods do |
23 | | - def flex_validates_nested(name) |
| 23 | + def strata_validates_nested(name) |
24 | 24 | validate :"validate_nested_#{name}" |
25 | 25 |
|
26 | 26 | # Adds a validator for an attribute that represents a value object. |
@@ -49,7 +49,7 @@ def flex_validates_nested(name) |
49 | 49 | end |
50 | 50 | end |
51 | 51 |
|
52 | | - def flex_validates_type_casted_attribute(name, error_type) |
| 52 | + def strata_validates_type_casted_attribute(name, error_type) |
53 | 53 | validate :"validate_type_casted_attribute_#{name}" |
54 | 54 |
|
55 | 55 | define_method "validate_type_casted_attribute_#{name}" do |
|
0 commit comments