enum value is wrong if define two inherited class with aasm and on rails.env.production
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 5.2k
- Forks
- 644
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
i define two inherited class with aasm,for example :
class Aasm01 < ApplicatioinRecord
aasm column: 'state01', enum: :state01_enum_hash do
....
end
end
class Aasm02 < aasm01
aasm column: 'state02', enum: :state02_enum_hash do
....
end
end
everything is ok when do rails.env.developement model
but, something wrong when do rails.env.production model
AASM::StateMachineStore.fetch(Aasm01, true).machine('default').config.enum # => :state02_enum_hash
AASM::StateMachineStore.fetch(Aasm02, true).machine('default').config.enum # => :state02_enum_hash
as above, Aasm01 use a wrong enum value which seem to fetch from Aasm02 , :(
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
No repository file or test is named. Start by reproducing the production-only behavior with the Aasm01/Aasm02 inheritance example, then inspect AASM::StateMachineStore.fetch and each machine's config.enum. Done means Aasm01 retains state01_enum_hash while Aasm02 retains state02_enum_hash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100