You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm refactoring code to use Single Table Inheritance and I'd really like to be able to override the class on each trait as opposed to defining a completely new factory for each subclass.
Desired solution
From an API perspective providing options to the trait call would be nice
factory :generator_performance do
trait :reactive_power_capability, class: '...' do
end
end
In my case I have an ActiveRecord Model that represents a bunch of different documents. The current model definition and its validations are loose enough to allow for the many shapes but it is a mess. There is a large core of shared properties. Currently each of the document types are defined as FactoryBot traits.
The text was updated successfully, but these errors were encountered:
Problem this feature will solve
I'm refactoring code to use Single Table Inheritance and I'd really like to be able to override the class on each trait as opposed to defining a completely new factory for each subclass.
Desired solution
From an API perspective providing options to the trait call would be nice
Alternatives considered
I'll either extract these to concrete classes now OR try the solution referenced at https://dev.to/epigene/simple-trick-to-make-factorybot-work-with-sti-j09
Additional context
In my case I have an ActiveRecord Model that represents a bunch of different documents. The current model definition and its validations are loose enough to allow for the many shapes but it is a mess. There is a large core of shared properties. Currently each of the document types are defined as FactoryBot traits.
The text was updated successfully, but these errors were encountered: