Reputation: 4380
I recently got the error:
You tried to define an enum named "label_type" on the model "Spree::ShippingMethod", but this will generate a instance method "label_type=", which is already defined by another enum.
The backtrace gives me the location of the enum that I attempted to define second, but not the first enum that was defined. Grepping through my codebase only brings up the file in the backtrace, so I suspect it's in a gem, but I don't how to find which gem it's in.
To be clear, I'm aware that the error I gave means that the enum has already been defined somewhere else. In the course of fixing this problem, I'm trying to figure out where it was defined.
Upvotes: 0
Views: 283
Reputation: 1864
It might be defined in a gem. It could be defined through meta-programming. Maybe you can find out more with the help of Pry:
show-method label_type=
exit-p
or !!!
to leave pry when done.Upvotes: 1
Reputation: 4220
I think you already have column or instance method label_type in that model. Basically when you define enum on a column it will create read/write method for setting that column value. FYI: Please refer this page http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html
Upvotes: 0