The FrozenRecord::Backends::Yaml module provides functionality for loading data from YAML files into FrozenRecord models. It supports both standard .yml files and .erb files (Embedded Ruby) for dynamic data generation.
ERB Support and Naming
- Standard YAML: Files ending in
.yml are loaded directly. - ERB Files: Files ending in
.erb are processed through the ERB engine before being parsed as YAML. - Naming Convention: To avoid deprecation warnings, if your YAML file contains ERB tags, ensure the file extension is explicitly
.erb.
Configuration for Legacy ERB Behavior
If you are using files that contain ERB tags but do not have the .erb extension, you can enable legacy support using the deprecated_yaml_erb_backend setting. However, it is recommended to rename these files to include the .erb extension and set FrozenRecord.deprecated_yaml_erb_backend = false to align with future behavior.
# Example of how the backend handles file loading logic
# If using ERB, ensure the file is named with .erb extension
# or configure the deprecated backend setting:
FrozenRecord.deprecated_yaml_erb_backend = true