Fix a bug affecting validations of enum attributes

This fixes a bug where any enum attribute of a model
would be evaluated always as 0 when calling the
database on validations.

This fix overrides the read_attribute_for_validation
method for enum attributes to make it return the
integer representing the value rather than the
value itself.
Added failing test on previous fix
Fix a bug affecting validations of enum attributes

This fixes a bug where any enum attribute of a model
would be evaluated always as 0 when calling the
database on validations.

This fix converts the value of the enum attribute
to its integer value rather than the string before
building the relation as the bug occured when the
string finally gets converted to integer using
string.to_i which converts it to 0.