SystemStackError for has_many assocation that points to own model
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 873
- Forks
- 164
- Avg merge
- 4d 27m
- Merged PRs (30d)
- 9
Description
I have a setup involving a model with a has_many that points to itself
class Group < ApplicationRecord
has_many :sub_groups, class_name: "Group", primary_key: "id", foreign_key: "parent_id"
end
each record has a parent_id to point to it's parent group.
This setup works fine with rails, but tapioca crashes when it tries to generate it with a SystemStackError
activerecord-7.1.3.2/lib/active_record/reflection.rb:967:in 'through_reflection': stack level too deep (SystemStackError)`
...
/thor-1.3.1/lib/thor/base.rb:584:in start
/tapioca-0.13.3/exe/tapioca:25:in '<top (required)>
Tested with Tapioca version 0.13.3
Contributor guide
No contributing guide indexed for this repository
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 by reproducing Tapioca 0.13.3 with the self-referential Group model and its has_many :sub_groups association. The trace points to activerecord-7.1.3.2/lib/active_record/reflection.rb:967 and the exe/tapioca entry point. Done means RBI generation completes without a SystemStackError for this association.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100