rom-rb / rom-factory

Data generator with support for persistence backends
MIT License
83 stars 42 forks source link

Support building structs when associated factories do not define parent associations #49

Closed psparrow closed 4 years ago

psparrow commented 4 years ago

This PR supports building structs when associated factories do not define parent associations.

factory(:parent) do |f|
  f.association(:child)
end

factory(:child) do |f|
end

# Before
factories[:parent] #=> Works!
factories.structs[:parent] #=> UnknownAttributeErrror :parent when structing the child

# After
factories[:parent] #=> Works!
factories.structs[:parent] #=> Works!