thoughtbot / thoughtbot/factory_bot
Question: Possible to get reference to the build_class from initialize_with?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 8.2k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
I'm working with STI and am customizing our initialize_with block. However, there are some conditions we'd like to put in place that require introspection on the class in question.
It seems there are a number of layers of indirection around the class (decorator, @component, @build_class, etc). Is there a way to get a reference to the factory's class (essentially new.class, but without invoking new) from within the initialize_with block?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the initialize_with entry point and trace the decorator, @component, and @build_class layers mentioned in the issue. Determine whether the factory's class can be referenced without invoking new, then document the supported behavior or clarify the API needed if it cannot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100