simple_enum
simple_enum copied to clipboard
simple_enum should add the attribute name to the attribute_names class method
ActiveRecord models include the attribute_names method, which, as the name suggests, lists all the attributes the model exposes. As it turns out, ParamsWrapper uses the result of this method to determine which attributes to wrap. Since it just uses column names by default, the column itself will be wrapped (e.g. gender_cd) but not the enum attribute (e.g. gender).
It would be nice if simple_enum extended this list to include the enum attribute name so that ParamsWrapper automagically works with models that include enums.
Thanks for the input, would there be any other unintended side-effects of exposing the _cd methods in attribute_names?