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.

[Vilius Luneckas, Ahmed AbouElhamayed]
Merge pull request #14203 from Alwahsh/aabouelhamayed

Fix a bug affecting validations of enum attributes