Commit graph

1 commit

Author SHA1 Message Date
Jan Provaznik
0665a8f730 Enable mapping to nil in enums
Enum in Rails 5 does not map nil values - IOW nil value remains nil,
even if there is a key with nil value in the enum definition.

This commit overrides the underlying Enum methods so nil value is
still mapped. This solution is far from being ideal: it uses dynamic
definition of methods which introduces more magic/confusion
into the codebase.

It would be better to get rid of the nil value in enums.
2018-06-06 20:46:54 +02:00