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
classRegisterModelincludeVirtus.model(unknown: false)attribute:name,StringendRegisterModel.new(name: "Ben Smith",mal_input: "---")#this should fail and raise error
The text was updated successfully, but these errors were encountered:
I don't think that the behaviour when model raises exception when you are trying to get an instance of it is useful. Sounds like anti-pattern. Instead of that you should probably define some method named valid? to check if model is valid or not and then manually raise an exception.
Sorry for necroposting, but it is default behavior in ActiveRecord and can really save you from typos in you code. I think optional mode with restricted unknown fields is a good idea.
For example,
The text was updated successfully, but these errors were encountered: