[V2] =>Extend YAML parsing to allow variable references
Problem
Given a YAML Seed file,
projects:
- name: My Project
creator_id: <%= @owner.id %>
namespace_id: <%= @namespace.id %>
traits:
- public
project_issues:
- title: My Issue
project_id: <%= # cannot reference here %>
Given 1 project and 1 issue, we cannot refer back to any created factory models.
Proposal
Introduce variables to YAML to allow referring back to previously declared models.
Example
projects:
- _id: my_project
name: My Project
creator_id: <%= @owner.id %>
namespace_id: <%= @namespace.id %>
traits:
- public
project_issues:
- title: My Issue
project_id: <%= projects.my_project.id %>
weight: 2
Perhaps use a _id attribute attached that can be used as a unique identifier.
Edited by Dan Davison