0

I have a model as:

class CashPayment < ActiveRecord::Base

 .....

 **enum status: [:processing, :paid, :invalid,:refund]**
end

Here,I have declared invalid status for cash_payment.But its giving me as error like:

*** ArgumentError Exception: You tried to define an enum named "status" on the model "CashPayment", but this will generate a instance method "invalid?", which is already defined by Active Record
Jaswinder
  • 1,455
  • 14
  • 27

1 Answers1

0

invalid? is already defined by ActiveRecord .

Your enum status also contains :invalid which provides a method as invalid?

Now there is a conflict while generating two invalid? method.

Try to give another name to your :invalid, say :invalid_rec

enum status: [:processing, :paid, :invalid_rec,:refund]
dp7
  • 6,651
  • 1
  • 18
  • 37