Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaces state machines create unnamespaced scopes #733

Closed
armchairdj opened this issue Mar 13, 2021 · 1 comment · Fixed by #735
Closed

Namespaces state machines create unnamespaced scopes #733

armchairdj opened this issue Mar 13, 2021 · 1 comment · Fixed by #735

Comments

@armchairdj
Copy link

Describe the bug

When creating a state machine with a namespace and create_scopes: true, I would expect the automatically created scopes to be prepended with the namespace. But they're not.

For example, with this state machine:

aasm column: :final_targeting_state, namespace: :final_targeting, create_scopes: true do
  state :unstarted, initial: true
  state :started
  state :succeeded
  state :failed
end

I would expect the class to respond to:

  • klass.final_targeting_unstarted
  • klass.final_targeting_started
  • klass.final_targeting_succeeded
  • klass.final_targeting_failed

But it doesn't. It responds to:

  • klass.unstarted
  • klass.started
  • klass.succeeded
  • klass.failed

This is different from the issue with double-creating method names in both their unnamespaced and namespaced versions. Here, it's not that two versions of each scope get created, namespaced & unnamespaced. It's that only one version gets created, and it's not the one I'd expect.

Expected behavior

I'd expect namespaces to be reflected in automatic scope names.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@caiohsramos
Copy link
Contributor

Do you guys mind if I take this one? I can start working on a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants