lwe / simple_enum

Simple enum-like field support for ActiveModel (including validations and i18n)
MIT License
414 stars 61 forks source link

simple_enum should add the attribute name to the attribute_names class method #108

Open lexi-lambda opened 9 years ago

lexi-lambda commented 9 years ago

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.

lwe commented 9 years ago

Thanks for the input, would there be any other unintended side-effects of exposing the _cd methods in attribute_names?