I'm using gem enumerize in my project. For now I have this:
class MyAddress < ActiveRecord::Base
enumerize :country, in: [:country1, :country2, :country3], default: :country2
end
Now I want to convert state
to be enumerize
. Obviously, each country has its own states. How can I do something like this:
class MyAddress < ActiveRecord::Base
enumerize :country, in: [:country1, :country2, :country3], default: :country2
enumerize :state, in: [{ country1: [:state11, :state12, :state13], country2: [:state21, :state22, :state23], country3: [:state31, :state32, :state33]} ]
end
Is it possible?