You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I feel like I must be missing something obvious. Using Virtus as to support an HTML form must be one of the intended use cases, no?
I have some fields, some with custom rails validations, some optional. Out of the box Virtus will store the original string value when coercion fails. So if someone puts 'aaa' into my DateTime field it now stores 'aaa'. I can't enable strict mode because that doesn't seem to allow nil values for my optional values.
So it seems like the only solution is to add additional rails validations to check the stored datatypes? At which point it seems like I'm not really using virtus at all? I could do this with "include ActiveModel::Model" and regular attr_accessor statements.
Am I missing something or have I misunderstood the intended use of this gem?
The text was updated successfully, but these errors were encountered:
I feel like I must be missing something obvious. Using Virtus as to support an HTML form must be one of the intended use cases, no?
I have some fields, some with custom rails validations, some optional. Out of the box Virtus will store the original string value when coercion fails. So if someone puts 'aaa' into my DateTime field it now stores 'aaa'. I can't enable strict mode because that doesn't seem to allow nil values for my optional values.
So it seems like the only solution is to add additional rails validations to check the stored datatypes? At which point it seems like I'm not really using virtus at all? I could do this with "include ActiveModel::Model" and regular attr_accessor statements.
Am I missing something or have I misunderstood the intended use of this gem?
The text was updated successfully, but these errors were encountered: