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
# This setup method is only called when used with validation macros or the
96
-
# class level <tt>validates_with</tt> method.
97
95
classValidator
98
96
attr_reader:options
99
97
@@ -107,7 +105,8 @@ def self.kind
107
105
108
106
# Accepts options that will be made available through the +options+ reader.
109
107
definitialize(options={})
110
-
@options=options.freeze
108
+
@options=options.except(:class).freeze
109
+
deprecated_setup(options)
111
110
end
112
111
113
112
# Return the kind for this validator.
@@ -123,6 +122,21 @@ def kind
123
122
defvalidate(record)
124
123
raiseNotImplementedError,"Subclasses must implement a validate(record) method."
125
124
end
125
+
126
+
private
127
+
defdeprecated_setup(options)# TODO: remove me in 4.2.
128
+
returnunlessrespond_to?(:setup)
129
+
ActiveSupport::Deprecation.warn"The `Validator#setup` instance method is deprecated and will be removed on Rails 4.2. Do your setup in the constructor instead:
0 commit comments