-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Labels
Description
We sometimes use AI to manually perform certain custom actions. This exposes us to human errors in the naming of optional arguments. Is it possible to have AI fail if arguments are passed for which no filter has been defined?
Example
class ObjectInteraction < ActiveInteraction::Base
boolean :commit, default: true
def execute
commit_transaction if commit?
end
endThis command will unintentionally commit the transaction since the argument is misspelled.
ObjectInteraction.run!(comit: false)Solution?
Introduce a class method and/or global option that changes the default behavior.
class ObjectInteraction < ActiveInteraction::Base
enforce_filters!
endObjectInteraction.run!(comit: false)
# => ActiveInteraction::MissingFilterError: no filter defined for argument `comit`