From 4a19b3dea650351aa20d0cad64bf2d5608023a33 Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Fri, 12 Dec 2014 14:47:38 -0800 Subject: Pass through the `prepend` option to `AS::Callback` I'm not sure what's the use case for this, but apparently it broke some apps. Since it was not the intended result from #16210 I fixed it to not raise an exception anymore. However, I didn't add documentation for it because I don't know if this should be officially supported without knowing how it's meant to be used. In general, validations should be side-effect-free (other than adding to the error message to `@errors`). Order-dependent validations seems like a bad idea. Fixes #18002 --- activemodel/lib/active_model/validations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activemodel/lib/active_model/validations.rb') diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index c1e344b215..6a2668b8f7 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -87,7 +87,7 @@ module ActiveModel validates_with BlockValidator, _merge_attributes(attr_names), &block end - VALID_OPTIONS_FOR_VALIDATE = [:on, :if, :unless].freeze + VALID_OPTIONS_FOR_VALIDATE = [:on, :if, :unless, :prepend].freeze # Adds a validation method or block to the class. This is useful when # overriding the +validate+ instance method becomes too unwieldy and -- cgit v1.2.3