Hi there, rarely, but it sometimes there is a typo in a keywords, for example: Time.now.change(moth: 1) instead of Time.now.month(month: 1), and there are no warnings or errors.
Methods that has silent behavior on a wrong keyword argument:
-
Time#change -
Date#change -
DateTime#advance -
Time#advance -
ActiveSupport::Callbacks::ClassMethods#skip_callbackexample:
skip_callback :save, :before, :saving_message, unles: -> { age > 18 }silent on wrongunlesoption
For example, methods from ActiveModel::Validations::ClassMethods already has that behavior:
has_many :posts, dependent: :destroy, foreign_key1: :author_id raises Unknown key: :foreign_key1. Valid keys are: :class_name, :anonymous_class,...
Would it make sense to add warnings or raise an ArgumentError (configurable)?
If the idea is acceptable, I would be happy to start implementing this feature.
Best regards, Marat