adzap/active_enum — pull request #43 by wavenger (2014-10-11 01:13:53+00:00)
Title: Adding the ability to write enums as strings.

Firstly, thank you for writing this module. It has improved the performance of my employer's application greatly.

We generally expect that a setter can accept a value from its own getter. However, when using ActiveEnum.use_name_as_value = true, enums must be written as either symbols or integers. Consider the following situation:

person = Person.new(sex: :male)
puts person.sex # "Male"
person.sex = person.sex
puts person.sex # nil

This behavior is counter-intuitive: a leaky abstraction. Particularly, it causes issues saving form data. This commit makes an enum accept strings, symbols and integers, fixing the leaky abstraction.

Take care and thank you for reviewing this request.