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

How to create two enums with same key value within a single class? #46

Open
shashikant-lokare opened this issue Nov 4, 2019 · 0 comments

Comments

@shashikant-lokare
Copy link

Example, if I try to create like below, it will give error
ArgumentError (You tried to define an enum named "payment_sub_status" on the model "OrderPayments::Payment", but this will generate a instance method "pending?", which is already defined by another enum.)

enum payment_status: { pending: 1, success: 2, failed: 3, cancelled: 4 } do
event :succeed do
after do
self.update_sub_status 'success'
end
transition %i[success pending failed] => :success
end
end

enum payment_status2: { pending: 1, success: 2, failed: 3, cancelled: 4 } do
event :succeed do
after do
self.update_sub_status 'success'
end
transition %i[success pending failed] => :success
end
end

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

No branches or pull requests

1 participant