I have a model object which is linked to a list of countries in a many-to-many relationship. The countries are keyed by their ISO 3166 alpha-2 codes.
The thing I'd like to accomplish is to save to use of a Country class and table, and only have my object have an accessor in the form of object.countries
that will return an array of strings, e.g: ["IL", "US", "IT", ... ]
.
Essentially, a sort of has_and_belongs_to_many
action with only the join table.
Is this possible?
Is there a best practice in the case of country lists?