Open armahillo opened 1 year ago
Hey @armahillo! I'd be happy to review such PR 🙂Remember that attribute
is a Rails
method, so we likely gonna have a different API, e.g.
include StoreModel::Model
attribute :color, :string
disallow_unknown_attributes true
or even
include StoreModel::Model[disallow_unknown_attributes: true]
attribute :color, :string
This PR could help.
Normally, the "UnknownAttributes" behavior is great and I find it very useful.
Sometimes, though, I want it to be a bit noisier when a field gets passed along to UnknownAttributes.
Could we get something like:
or
If the former, it could be done as a validator (invalid the model if the field is a StoreModel descendant and
unknown_attributes
isn't empty; if it's the latter, then don't rescue "UnknownAttributesError".