Skip to content

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

Description

@shashikant-lokare

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions